2

在我的项目中,我使用 cgridview 来显示一些信息并使用使用 cgrid 视图构建的分页。但现在我面临分页的可用性问题。也就是说,考虑我有 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;
}
4

1 回答 1

3

在你的css文件中你需要写

.yiiPager .hidden, .yiiPager .first, .yiiPager .last {
display: none;
}
于 2011-10-12T09:04:16.940 回答