TbExtendedGridView小部件中是否有一个选项,您可以在其中设置要在每个页面中显示的项目?我目前有这个设置
$this->widget('bootstrap.widgets.TbExtendedGridView',array(
'id' => 'client-list',
'dataProvider'=>$model->search(),
'filter'=>$model,
'type' => array('striped', 'bordered', 'condensed'),
'template' => '{pager}{summary}{items}{pager}',
'pagerCssClass' => 'pagination',
'rowCssClass' => 'pagination',
'pager' => array(
'header' => '',
'hiddenPageCssClass' => 'disabled',
'maxButtonCount' => 3,
'cssFile' => false,
// 'class' => 'pagination',
'prevPageLabel' => '<i class="icon-chevron-left"></i>',
'nextPageLabel' => '<i class="icon-chevron-right"></i>',
'firstPageLabel' => 'First',
'lastPageLabel' => 'Last',
'htmlOptions'=>array('class'=>'your_css_class'),
),
'columns'=>$gridColumns,
'responsiveTable' => true,
'enablePagination' => true,
));
修改
感谢@ineersa的回答。我已经修改了我的模型的搜索功能:
public function search() {
$criteria=new CDbCriteria;
$criteria->compare('first_name',$this->first_name,true);
$criteria->compare('last_name',$this->last_name,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
到此:
public function search() {
$criteria=new CDbCriteria;
$criteria->compare('first_name',$this->first_name,true);
$criteria->compare('last_name',$this->last_name,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'pagination'=>array('pageSize'=>20),
));
}
答案 0 :(得分:3)
我不知道TbExtendedGridView,但我相信简单的pagesize会完成这项工作。
在返回之前将其添加到$model->search()
:
$dataProvider->setPagination(array('pageSize' => 10));