2017-02-06 38 views
0

我在查看頁面中有兩個表格,使用Yii中的CGridView小部件。對視圖中所有表格的分頁效果yii

$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'), 
)) 

另一個表

$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'), 
)) 

當我在分頁2點擊頁面從第一個表它會去第二次。但同時剩下的桌子也轉到第二頁。所以,如果我從任何表中點擊任何頁面。該分頁影響查看頁面中的所有表格。如何防止其他我點擊表格的分頁。

回答

0

最後,我找到了答案,我只是刪除線'enableHistory'=>true,