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

Using PaginatedList in SS3 [SOLVED]


Go to End


2 Posts   2042 Views

Avatar
Optic Blaze

Community Member, 190 Posts

11 September 2012 at 8:17am

Hi there,

I have a class called PostalCodes that stores all the postal codes details.

In the PostalCodes.php file i have set up the PaginatedList function so that my .ss template displays the list of postal codes with pagination included. This is working well and currently looks like this:

public function PaginatedPages() {
return new PaginatedList(PostalCodes::get(), $this->request );
}

What i need to do is customise the function so that it displays 30 records at a time and not the default 10.
From the API documentation i gathered that i must put the method in an array like this:

public function PaginatedPages() {
$request = array(
'getPageLength ' => '30',
);
return new PaginatedList(PostalCodes::get(), $this->request );
}

It is not working. Any help would be great

Thanks

Avatar
stallain

Community Member, 68 Posts

10 October 2012 at 5:04am

Hi, I don't know how you solved this, but I think this should work :

public function PaginatedPages() { 
$paginatedList = new PaginatedList(PostalCodes::get(), $this->request );
$paginatedList->setPageLength(50);
return $paginatedList;
}