Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Pagination too long


Reply


3 Posts   391 Views

Avatar
Bagzli

Community Member, 37 Posts

19 February 2014 at 11:55am

Hey guys,

I was wondering is there a public guide or code that somebody did before that would show how to shorten my pagination? I am using the pagination that tutorials recommend however I have 30 pages of news and it lists 1-30, it doesn't look good. I'm looking a way to make it so that it shows 1 2 3 ...18 19 [20] 21 22 ... 30

And if I were to click on 22 then it would show 1 2 3 ... 20 21 [22] 23 24 ... 30. This is fairly coming in websites, just wondering if there is another version to pagination that is shown in tutorials. I've been researching but could not find anything.

Avatar
simon_w

Forum Moderator, 474 Posts

19 February 2014 at 1:09pm

You want to loop over PaginationSummary instead of Pages. See the [url=http://api.silverstripe.org/3.1/class-PaginatedList.html#_PaginationSummary]api docs[/url] for an example of how to use them (you need to click on the cell to see all the contents of it).

Avatar
Bagzli

Community Member, 37 Posts

23 February 2014 at 7:01am

Thank you, that worked.