문제

i like to get the pagination in the CGridView in this format

  • normal structure: << < 1 2 3 4 5 6 7 8 9 > >>
  • require structure: << < 4 5 6 > >>

is there any solution for this. please help me.

도움이 되었습니까?

해결책

Simple changing CLinkPager

in your config should be a strings:

'import'=>array(
    'application.components.*',
),

Create a file ./protected/components/LinkPager.php

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

Then when you use CGridView in your code:

$this->widget('zii.widgets.grid.CGridView', array(
    'dataProvider'=>$dataProvider,
    'pager'=>'LinkPager',
));

By steps above, you creating a new pager class, which is used by CGridView for rendering pager section.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top