Changing default CGridView pagination component

Hi,

[s]Can someone give me any idea on what is the fastest way to extend standard pagination component used by default with CGridView, and use extended version with it?

I saw, how it is solved in alphapager extension, but I hope this can be done a little bit easier, than using own - extended versions of CDataProvider and CGridView?[/s]

All right, got it. Need to extend CLinkPager with my own class and force CGridView to use new class by modyfing pager property.

I only need a simple tweakups to original pagination component - i.e. a possibility to add "first page" / "last page" button,

Build in feature of CLinkPager. The good question is, why I don’t see buttons for first/last page, even if I change firstPageLabel property’s value?

maybe to add drop down list with all pages (but this is optional and not necessary)

Can be done, by combining CListPager and CLinkPager in one, extended class used for pagination.

and to be able to change behaviour of pagination for first page (it does not add _page=1 for first page, which is very necessary in case of my project).

Can be done by defining own class for pagination, extending from built-in CPagination and using it in own paginator.

Thanks in advance for any help,

Thanks in advance for answering last question that is left to answer: why I don’t see buttons for first/last page?

Trejder

Hi, Trejder,

framework/web/widgets/pagers/pager.css has the following lines at the end.




/**

 * Hide first and last buttons by default.

 */

ul.yiiPager .first,

ul.yiiPager .last

{

    display:none;

}



It should be "display:inline" when you want the first and the last buttons to be displayed.

This can be overridden by either …

  1. Writing your own CSS file for the pager and assign it to the "cssFile" property of the pager.

… or …

  1. Adding a CSS snippet to the html of the views where you want the first and the last buttons.

FYI

Issue 1163: CLinkPager First and Last links always hidden

Issue 1556: CLinkPager first/last buttons enable/disable, feature-request

Thank you (+1), softark, for your detailed explanation.

I must admit that I’m a little bit shocked that this is currently implemented this way - i.e. CSS file modifications are required to decide if these buttons are or are not displayed - as I find this approach very bad and completely useless. Let me paste here my comments and doubts I wrote in response to one of the bug-tickets / feature-requested you provided:

Cheers,

Trejder