Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Where to set default pagesize?

$
0
0
Hi guys

I'm new here so be gentle ;)!
After using yii for quite some time i know it quite good already.

Directly to my question: Is there a way to set the default pagesize (eg for CGridView) in the main app config (/protected/config/main.php)!? If so...how would i do it?

I'm aware of that i can set the value in the model via a public param of the config like so:
public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('iso_code_number',$this->iso_code_number,true);
		$criteria->compare('iso_code',$this->iso_code,true);
		$criteria->compare('identifier',$this->identifier,true);
		$criteria->compare('created',$this->created,true);
		$criteria->compare('changed',$this->changed,true);
		$criteria->compare('changed_by',$this->changed_by,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
			'pagination'=>array(
				[b]'pageSize'=>Yii::app()->params['defaultPageSize'],[/b]		
			),
		));
	}


But I'm looking for a cleaner way to set this value globally in the config without having to touch each model. I found no such solution on the web or in this forum...


thanks already in advance,
pascal

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>