Jump to:

1160 Posts in 2621 Topics by 409 members

Upgrading SilverStripe

SilverStripe Forums » Upgrading SilverStripe » [Solved] The method 'setpagesize' does not exist on 'PaginatedList'

Ask questions about upgrading SilverStripe to the latest version.

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

Page: 1
Go to End
Author Topic: 682 Views
  • TC81
    Avatar
    Community Member
    11 Posts

    [Solved] The method 'setpagesize' does not exist on 'PaginatedList' Link to this post

    I'm upgrading a site from 2.4.5 to 3.0.5 and I've managed to resolve most of the issues I have come up against, but this one has got me stumped.

    I have a custom module - a "song library" - that is made up of several dataObjects: song, theme, subtheme and publisher. I use a custom searchcontext to provide search facilities on the front end of the site with paginated results. This was working fine in 2.4.5. I've done some minor tweaks (getting changing methods to populate dropdown menu's etc) but otherwise the actual search functions are basically exactly what's here: http://doc.silverstripe.org/framework/en/reference/searchcontext

    I can get the search function to return un-paginated results, but when I try and use paginated results I get the following error:

    the method 'setpagesize' does not exist on 'PaginatedList'

    I'm a bit stuck because my functions are so close to the examples I don't get it. Is it possibly something in the template? One of the only differences is I use: renderWith(array('SongSearch_results', 'Page'); instead of renderWith('SongSearch_results'); but I've tried changing that line and it seems to make no difference.

  • TC81
    Avatar
    Community Member
    11 Posts

    Re: [Solved] The method 'setpagesize' does not exist on 'PaginatedList' Link to this post

    I could be wrong but it appears that the code at http://doc.silverstripe.org/framework/en/reference/searchcontext is actually incorrect. In order to use paginated results I've used the following instead:

    public function doSearch($data, $form) {
           $context = singleton('MyObject')->getCustomSearchContext();
           $results = $context->getResults($data);
           $results = new PaginatedList($results, $this->request);
          
           return $this->customise(array(
           'Results' => $results
           ))->renderWith(array('MyObject_results', 'Page'));
          }


    Just thought I'd share incase anyone else runs into the same problem - it may be the code on that page works and I was making some other mistake, but the above snippet seems to have done the trick for me.

    682 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.