Hi
How can we customize the default pagination generated by CRUD?. To be specific, the default pagination shows 10 records per page, how can i change number of records per page ?
Thanx & Regards
Sukhwinder Singh
Hi
How can we customize the default pagination generated by CRUD?. To be specific, the default pagination shows 10 records per page, how can i change number of records per page ?
Thanx & Regards
Sukhwinder Singh
Edit the function search in the model.
change to:
return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria,
'pagination'=>array('pageSize'=>5),
));
And the actionIndex to:
/**
* Lists all models.
*/
public function actionIndex()
{
$dataProvider=new CActiveDataProvider('Town',array('pagination'=>array('pageSize'=>5)));
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
Thanx zaccaria
Yii docs needs more elaboration, otherwise excellent framework !!1
I just difficoult to retrive information, but is not so hard:
check the page for CActiveDataProvider, you will find the property pagination.
There is indicated that this property is supposed to be a CPagination.
On the page of CPagination you will find the property pageSize.
The difficoult part is to know the object you are working with, and wich one can suite for you,.
This knowlenge you can achive only with experience.