Jump to:

23493 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Using PaginatedList in SS3 [SOLVED]

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

Page: 1
Go to End
Author Topic: 1062 Views
  • Optic Blaze
    Avatar
    Community Member
    162 Posts

    Using PaginatedList in SS3 [SOLVED] Link to this post

    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

  • stallain
    Avatar
    Community Member
    61 Posts

    Re: Using PaginatedList in SS3 [SOLVED] Link to this post

    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;
    }

    1062 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.