Yii 分页器Pagesize的设置方法

以search()为例,在相应的dataProvider里设置pagination属性。在view页面找到相应的dataProvider设置同样有效。

public function search()
{
    // Warning: Please modify the following code to remove attributes that
    // should not be searched.
    $criteria=new CDbCriteria;
    $criteria->compare('id',$this->id);
    $criteria->compare('manager_id',$this->manager_id);
    $criteria->compare('content',$this->content,true);
    return new CActiveDataProvider($this, array(
        'criteria'=>$criteria,
        'pagination'=>array(
            'pageSize'=>20,
        ),
    ));
}
若您觉得我的博文对您有帮助,欢迎点击下方按钮对我打赏
打赏