Saturday, October 15, 2011

Show more records per page Yii

to display more records in CGrid in Yii simply add one line to your model :)


protected/models/Product.php


/*** Retrieves a list of models based on the current search/filter conditions.
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.*/


public function search()
{
// Warning: Please modify the following code to remove attributes that should not be searched.
$criteria=new CDbCriteria;


$criteria->compare('Product_Code',$this->Product_Code,true);
$criteria->compare('Name',$this->Name,true);
$criteria->compare('Short_Description',$this->Short_Description,true);



return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria,  
                'pagination'=>array('pageSize'=>20,), //framework/web/CPagination.php
));
}

1 comment:

About

Blogger templates