视图yii中所有表的分页效果

Pagination effect on all tables in a view yii

我在视图页面中有两个 table,使用 Yii 中的 CGridView 小部件。

$this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'property-grid',
    'itemsCssClass'=>'table table-hover table-nomargin table-striped grid-view table-responsive',
    'filter'=>$model,
    'dataProvider'=>$model->search_property(),    
    'enablePagination' => true,   
    'enableHistory'=>true,    
    'pagerCssClass'=>'dataTables_paginate paging_bootstrap table-pagination',
    'pager' => array('header'=>'','htmlOptions'=>array('class'=>'pagination')),
    'columns' => array(
        array(name=>'project_id','value'=>'$data["project_name"]','header'=>'Project','filter'=>CHtml::activeDropDownList($model,'project_id',CHtml::listData($model->selectProjectAll(),'project_id','project_name'),array('prompt'=>'All'))),
        array(name=>'flat_no','value'=>'CHtml::textField("flat_no",$data["flat_no"]."  ".$data["customer_name"],array("class"=>"gridfield"))','header'=>'Flat No','type'=>'raw'),
        array(name=>'type','value'=>'$data["type"]','header'=>'Type'),
        array(name=>'status','value'=>'$data["status_name"]','header'=>'Status','filter'=>CHtml::activeDropDownList($model,'status',CHtml::listData($model->selectstatustAll(),'id','status'),array('prompt'=>'All')),'htmlOptions' => array('style' => 'width: 120px;')),
    ),
    'htmlOptions'=>array('class'=>'table table-hover table-nomargin'),
))

另一个table

$this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'target-grid',
    'itemsCssClass'=>'table table-bordered table-condensed table-hover table-striped dataTable',    
    'dataProvider'=>$model->sales_target_search(),
    'enablePagination' => true,
    'enableHistory'=>true,
    'pagerCssClass'=>'dataTables_paginate paging_bootstrap table-pagination',
    'pager' => array('header'=>'','htmlOptions'=>array('class'=>'pagination')),
    'columns' => array(
        array(name=>'user','value'=>'$data["username"]','header'=>'Executive'),
        array(name=>'from_date','value'=>'Yii::app()->dateFormatter->format("dd/MM/yyyy",$data["from_date"])','header'=>'From Date'),
        array(name=>'to_date','value'=>'Yii::app()->dateFormatter->format("dd/MM/yyyy",$data["to_date"])','header'=>'To Date'),
        array(name=>'target','value'=>'$data["target"]','header'=>'Target'),
        array('value'=>'$data["total"]','header'=>'Achieved'),
    ),
    'htmlOptions'=>array('class'=>'table table-hover table-nomargin'),
))

当我在分页中从第一页 table 单击第 2 页时,它将转到第二页。但同时剩余 tables 也转到第二页。因此,如果我单击任何 table 中的任何页面。该分页对视图页面中的所有 table 都有效。我点击 table.

其他如何防止分页

最后我找到了答案我只是删除了行 'enableHistory'=>true,