简体   繁体   中英

How to customize Yii CGridView Pager?

如何自定义Yii CGridView寻呼机的位置,css,模板?

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'  => '&gt;&gt;',
    ),
    'template'=>'{pager}{items}{pager}',
    'columns'=>$arrayColumns,
));

Here's another approach which worked for me.

Displaying Yii's CLinkPager "First" and "Last" Buttons

If you have troubles, make sure to read the comments below the entry.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM