在我的项目中,我使用cgridview显示一些信息,并使用用cgrid视图构建的分页。但是现在我面临着分页的可用性问题。也就是说,假设我有3页,分页看起来像<< <1 2 3> >>。当我点击第3页时,分页应该看起来像<< <1 2 3,如果是第1页,分页应该看起来像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(......));此外,我还在组件CLinkPager中扩展LinkPager类。
class LinkPager extends CLinkPager
{
public $maxButtonCount=3;
}发布于 2011-10-12 09:04:16
在css文件中,您需要编写
.yiiPager .hidden, .yiiPager .first, .yiiPager .last {
display: none;
}https://stackoverflow.com/questions/7737556
复制相似问题