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.

Data Model Questions /

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

The method 'getviewer' does not exist on 'PaginatedList'

Go to End

3 Posts   1476 Views


Community Member, 99 Posts

6 December 2012 at 1:39am

Edited: 06/12/2012 11:24pm

I want to be able to filter a paginated list based on passed params.
eg filter buy Area, category ..etc
if i go directly to the page i do not get an error.

 class EstateCategoryPage_Controller extends Page_Controller {
static $allowed_actions = array(

//do i need a routes.yml file
public static $url_handlers = array(
	       'property//$Action/$ID/$EstateCategoryPageID' => 'EstateItemList'

function EstateItemList() {
	$Area = '%';
	$OfferStatus = 'FOR SALE';
	$ECatPageID = 30;
	/* test for retrival of QueryString 
	$CatPageID = Controller::curr()->getRequest()->param('EstateCategoryPageID');
	//$CatPageID = $this->request->param('EstateCategoryPageID');
	//print query string
	//print_r($CatPageID);   //yeap it works
	 $buildfilter = EstateItem::get()->filter(array('Area:PartialMatch'=> $Area,'Active' => 1,'OfferStatus' => $OfferStatus));
	 //fixes the page in pagination
	  $PaginatedList = new PaginatedList($buildfilter,$this->request);
	   return $PaginatedList;	

//comment   i'm not actually doing any filtering yet from the passed steps!

}//end controller

If i go to the page and call a function to pass query string i get an error


error : The method 'getviewer' does not exist on 'PaginatedList'

i've looked at this ticket also

and tried

return $this->customise($PaginatedList)->renderWith('PropertyResults');

error : The method 'getviewer' does not exist on 'DataList'

return $this->customise($buildfilter)->renderWith('PropertyResults');

error : The method 'getviewer' does not exist on 'DataList'

// Please do not change the exception code number below.
661 throw new Exception("Object->__call(): the method '$method' does not exist on '$this->class'", 2175);

Line 661 in /home/hmyapp/public_html/framework/core/Object.php


Forum Moderator, 5522 Posts

8 December 2012 at 4:47pm

You're trying to render a list directly using /EstateItemList/ in the browser which rather than returning an HTML template you've got it returning a List.

You should name your action and method *differently* or render the list into some template instead of returning it.

static $allowed_actions = array(

In your template then you would use <% loop EstateItemList %>

Make sure in your template you don't simply chuck $EstateItemList in as SilverStripe knows it's a list but not how you want to display it. You need to use <% loop %> to iterate over it.


Community Member, 99 Posts

11 December 2012 at 12:22am

Edited: 21/12/2012 11:27pm

many thanks that worked.


I have
mysite > routes.yml
Name: myroutes
After: framework/routes#coreroutes
'property//$Action/$EstateCategoryPageID/$Area/$OfferStatus': 'EstateCategoryPage_Controller'

but this results in a error
[User Warning] popCurrent called on ModelAsController controller, but it wasn't at the top of the stack

basically i want to access more that the standard 2params of ID/OtherID
how i can use more than 2 params

for example:

I can get my app to work by doing