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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Change Pagination number


Go to End


3 Posts   588 Views

Avatar
Bagzli

Community Member, 71 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, 1391 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, 71 Posts

3 February 2014 at 4:07am

Edited: 03/02/2014 4:37am

Thank you, worked like a charm.