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

Using PaginatedList in SS3 [SOLVED]


Reply


2 Posts   1156 Views

Avatar
Optic Blaze

Community Member, 165 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, 61 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;
}