How to customize Yii CGridView Pager?
23,357
Solution 1
You can custumize via 'pager' CGridView properties. Example:
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'My-grid',
'dataProvider'=>$dataProvider,
'pager'=>array(
'header' => '',
'firstPageLabel' => '<<',
'prevPageLabel' => '<img src="images/pagination/left.png">',
'nextPageLabel' => '<img src="images/pagination/right.png">',
'lastPageLabel' => '>>',
),
'template'=>'{pager}{items}{pager}',
'columns'=>$arrayColumns,
));
Solution 2
- http://www.yiiframework.com/doc/api/CBaseListView#pager-detail
- http://www.yiiframework.com/doc/api/CBaseListView#pagerCssClass-detail
- http://www.yiiframework.com/doc/api/CLinkPager
Related videos on Youtube
Author by
tq0fqeu
Updated on July 09, 2022Comments
-
tq0fqeu almost 2 years
How to customize Yii CGridView Pager about its position, css, template?
-
Sam Dark almost 14 yearsIf you want just to customize how it looks you can use yiiframework.com/doc/api/CLinkPager#cssFile-detail to apply your own styles. These properties are specified in the array yiiframework.com/doc/api/CBaseListView#pager-detail. So property name is key, property value is value. If you want to customize markup itself or generation login it's better to create your own component that extends CLinkPager or CBasePager and specify its class as value of "class" key of CBaseListView::pager property.
-
ThorSummoner about 10 yearsPlease post the link's answer in your answer in case that link ever dies.