Tuesday, January 15, 2013

YII: Changing Number of Items in the GGridView

In order to change the number of items in the GGridView, you can go to model and find search() method and add the following.


        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);
                ....

                return new CActiveDataProvider(get_class($this), array(
                        'criteria' => $criteria,
                        'pagination' => array(    // pagination property
                                'pageSize' => 30, // page size
                        ),                        // 
                ));
        }

No comments: