2
在TbExtendedGridView小部件中是否有一個選項,您可以在其中設置要在每個頁面中顯示的項目?我現在有這個設置如何在YiiBooster模塊中設置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),
));
}
非常感謝!我一直在尋找這個最長的時間! – JohnnyQ