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

Change Pagination number


Reply


3 Posts   197 Views

Avatar
Bagzli

Community Member, 37 Posts

30 January 2014 at 4:19pm

Hey guys,

I've tried following this tutorial to get pagination working: http://doc.silverstripe.com/framework/en/howto/pagination

I've managed to get it to work and it defaults to 10 results per page, however I cannot figure out how to change that number and set it to 3 or 5 or whatever I need. I'm not sure what the code is nor where I would put it.

Anyone can help?

Avatar
martimiz

Forum Moderator, 1106 Posts

2 February 2014 at 2:54am

This should work:

   public function PaginatedPages() {
      return PaginatedList::create(Page::get(), $this->request)->setPageLength(3);
   }

Avatar
Bagzli

Community Member, 37 Posts

3 February 2014 at 4:07am

Edited: 03/02/2014 4:37am

Thank you, worked like a charm.