php 如何自定义 Yii CGridView Pager?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2902723/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 08:04:23  来源:igfitidea点击:

How to customize Yii CGridView Pager?

phpyii

提问by tq0fqeu

How to customize Yii CGridView Pager about its position, css, template?

如何自定义 Yii CGridView Pager 的位置、css、模板?

回答by Davuz

You can custumize via 'pager' CGridView properties. Example:

您可以通过“pager”CGridView 属性自定义。例子:

$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,
));

回答by Meetai.com

Here's another approach which worked for me.

这是另一种对我有用的方法。

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

显示 Yii 的 CLinkPager“第一个”和“最后一个”按钮

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

如果您遇到问题,请务必阅读条目下方的评论。