Question

In my project, i am using cgridview to display some information and using the pagination built with the cgrid view. but now i am facing a usability problem with pagination. that's, consider i have 3 pages and the pagination looks like << < 1 2 3 > >>. when i clicked the 3rd page the pagination should look like << < 1 2 3 and in case of 1st page the pagination should look like 1 2 3 > >>. how can i do this. please provide me a solution.

my widget looks like.

$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(......));

also i am extending the CLinkPager class in the the component LinkPager.

class LinkPager extends CLinkPager
{
    public $maxButtonCount=3;
}
Était-ce utile?

La solution

in your css file you need to write

.yiiPager .hidden, .yiiPager .first, .yiiPager .last {
display: none;
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top