可以用以下三种方法
1.在view里面
<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,
));