I have a project in Yii where there is a CGridView
that by default shows 10 records per page. How can I set this to 100 records?
You can configure in Search function of the Model like below:
public function search()
{
$criteria=new CDbCriteria;
$criteria->compare('id',$this->id,true);
$criteria->compare('start_year',$this->start_year,true);
$criteria->compare('end_year',$this->end_year,true);
$criteria->compare('ref_lang_id',$this->ref_lang_id);
$criteria->compare('submitted_at',$this->submitted_at,true);
$criteria->compare('ref_submitted_user_id',$this->ref_submitted_user_id,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'pagination' => array(
'pageSize' => 30,
),
));
}
Find in your view the place where the CGridView
widget is being rendered, and configure the pagination
property of the data provider:
$this->widget('zii.widgets.CGridView', array(
'dataProvider' => array(
/* other options for the data provider... */
'pagination' => array('pageSize' => 100),
),
/* other options for the grid view... */
));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With