Wednesday, June 06, 2012

YII: How to Customize YII pager in CGridView

If you want to customize YII pagination or pare in CGridView usually located in view files, you can specify cssFile in pager inside CGridView.
$this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'post-grid',
    'dataProvider'=>$model->search(),
    'filter'=>$model,
        'cssFile' => Yii::app()->theme->baseUrl."/css/cgridviewcss.css",
    'columns'=>array(
                'id',
                'title',
                'content',
                array(
                   'class'=>'CButtonColumn',
                ),
    ),
        'htmlOptions'=>array('class'=>'add_css_class_name_for_CGridView_here'),
        'pager'=> array(
            'header' => '',  //if you want to get read of pager heading
            'cssFile' =>Yii::app()->theme->baseUrl."/css/style-of-pager.css",
        ),
Then, you can create style-of-pager.css and modify the pager.css (that is in the Yii Framework).
http://www.yiiframework.com/forum/index.php/topic/26055-change-the-general-pager-css-for-all-application/ 

No comments: