yii - CgridView分页链接

标签 yii pagination cgridview

在我的项目中,我使用 cgridview 来显示一些信息并使用使用 cgrid View 构建的分页。但现在我面临着分页的可用性问题。也就是说,假设我有 3 个页面,分页看起来像 <<< 1 2 3 >>>。 当我单击第三页时,分页应类似于 <<< 1 2 3,如果是第一页,分页应类似于 1 2 3 >>>。我怎样才能做到这一点。请给我一个解决方案。

我的小部件看起来像。

$widget = $this->widget('zii.widgets.grid.CGridView', array(
                    'id' => 'request-grid',
                    'dataProvider' => $model->search(),
                    'cssFile' => Yii::app()->baseUrl . '/media/css/gridview.css',
                    'summaryText' => '',
                    'enablePagination' => true,
                    'template' => '{items}',
                    'pager' => array(
                        'class' => 'LinkPager',
                        'cssFile' => false,
                        'header' => false,
                        'firstPageLabel' => 'First',
                        'prevPageLabel' => 'Previous',
                        'nextPageLabel' => 'Next',
                        'lastPageLabel' => 'Last',
                    ),
                    'columns' => array(......));

我还在组件 LinkPager 中扩展了 CLinkPager 类。

class LinkPager extends CLinkPager
{
    public $maxButtonCount=3;
}

最佳答案

在你的css文件中你需要编写

.yiiPager .hidden, .yiiPager .first, .yiiPager .last {
display: none;
}

关于yii - CgridView分页链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7737556/

相关文章:

php - 如何在 yii cgridview 中动态更改 cbuttoncolumn 标签

database - Yii 记录未插入数据库

sql - 无法将参数绑定(bind)到 CDbCommand

javascript - 在yii controller中注册css和js是不是更好?

html - will_paginate 当前页始终为 1

javascript - 使用jquery分页

php - mysql搜索获取特定行

php - Cgridview 中动态列的 Chtml 链接 - Yii Framework

php - 如何在 Yii 框架中获取用户 ID 而不是名称?

php - yii 中 cgridview 中的固定大小列