更改gridview pageSize

可以用以下三种方法

1.在view里面

$provider=$model->search();
$provider->pagination->pageSize=20;
$this->widget('zii.widgets.grid.CGridView', array(
        'id'=>'link-grid',
        'dataProvider'=>$provider,

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,

));

你可能感兴趣的:(GridView,pagesize)