时间:2021-07-01 10:21:17 帮助过:11人阅读
<span style="color:#000000;">$provider=$model->search();
$provider->pagination->pageSize=20;
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'link-grid',
'dataProvider'=>$provider,</span>
2.在model的search方法里
代码如下:
return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria,
'pagination'=>array(
'pageSize'=> 5,
),
));
3.在controller里
代码如下:
$dataProvider=new CActiveDataProvider('Post', array(
'pagination'=>array(
'pageSize'=>Yii::app()->params['postsPerPage'],
),
'criteria'=>$criteria,
));