douxia6163 2017-02-06 05:36
浏览 84
已采纳

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

I have two tables in view page, using CGridView widget in 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'),
))

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

When I click on page 2 from first table in pagination it will go to second. But the same time remaining tables also go to second page. So if I click any page from any table. That pagination is effecting on all table in a view page. How to prevent pagination other that I click the table.

  • 写回答

1条回答 默认 最新

  • dongmeng1868 2017-02-15 04:27
    关注

    Finally i found the answer i just remove the line 'enableHistory'=>true,

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 vhdl+MODELSIM
  • ¥20 simulink中怎么使用solve函数?
  • ¥30 dspbuilder中使用signalcompiler时报错Error during compilation: Fitter failed,求解决办法
  • ¥15 gwas 分析-数据质控之过滤稀有突变中出现的问题
  • ¥15 没有注册类 (异常来自 HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
  • ¥15 知识蒸馏实战博客问题
  • ¥15 用PLC设计纸袋糊底机送料系统
  • ¥15 simulink仿真中dtc控制永磁同步电机如何控制开关频率
  • ¥15 用C语言输入方程怎么
  • ¥15 网站显示不安全连接问题