pageSize & Number of pagination Links

i am new to YII. migrated from zend to yii.

i need to know how to change pageSize value i want to show 20 record instead of default 10. and i wana change ajax pagination links to 5 instead of 10 default.

any idea i tried with ‘pagination’=>array(‘pageSize’=> 20) but that not worked for me.


this is default

so use


to change number of buttons add this to array


$pages is object of which class ??

why not overide CLinkPager and

public $maxButtonCount = 5;

and than in view ‘pager’ => ‘application.extensions.my_page’,

$pages is my object name… u can use like this…

or post ur code

public function actionIndex()


		$dataProvider=new CActiveDataProvider('User');








this my index view


$this->widget('zii.widgets.grid.CGridView', array(


    //'pager' => 'application.extensions.my_page', //this is working

    'maxButtonCount'=>5, //this is not working 


    'columns' =>array(






                                     'name' =>'date_created',

                                     'value'=>'date_format(date_create($data->date_created), "Y-m-d H:i:s")',






CGridView::pager property can be used to customize any of public properties of the pager (by default it’s CLinkPager). So you code should look like:

$this->widget('zii.widgets.grid.CGridView', array(







ok i think u r telling about only Clinkpager

try like this

public function actionIndex()


		$dataProvider=new CActiveDataProvider('User',array('pagination'=>array(









Thanks a lot Rajith it exactly I was looking for!!!

hi friends you can also use

$criteria = new CDbCriteria;

        &#036;total = Post::model()-&gt;count();

        &#036;pages = new CPagination(&#036;total);

        &#036;pages-&gt;pageSize = 20;


        &#036;posts = Post::model()-&gt;findAll(&#036;criteria);

    &#036;this-&gt;render('index', array(

            'posts' =&gt; &#036;posts,

            'pages' =&gt; &#036;pages,