I want to be able to filter a paginated list based on passed params.
eg filter buy Area, category ..etc
http://dev.mydomain.co.uk/property
if i go directly to the page i do not get an error.
class EstateCategoryPage_Controller extends Page_Controller {
static $allowed_actions = array(
'show','EstateItemList'
);
//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);
$PaginatedList->setPageLength(2);
$PaginatedList->setLimitItems(1);
return $PaginatedList;
}
//comment i'm not actually doing any filtering yet from the passed params..baby steps!
....
}//end controller
If i go to the page and call a function to pass query string i get an error
http://dev.mydomain.co.uk/property//action/params/params/
eg: http://dev.mydomain.co.uk/property//EstateItemList/29/Offices/
error : The method 'getviewer' does not exist on 'PaginatedList'
i've looked at this ticket also
http://www.silverstripe.org/data-model-questions/show/11817
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.
660
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