I am trying to use Ajax pagination in CakePHP and have read you can pass the variables along in the URL however I cannot seem to set the route. When I click on next I get an error about the category not existing (because of a custom validation method I created) because the route isn't being followed.
I would like the $paginator->next()
and $paginator->prev()
to follow this scheme of routes
http://mysite.com/computers/page:2
or http://mysite.com/computers/mac/page:2
. However no matter what I set the pagination URL to it always ends up becoming http://mysite.com/Products/index/page:2
. I have tried setting the URL in the $paginator->options()
and in the $paginator->next()
and $paginator->prev()
however it is not working. Any ideas on how to make cakephp paginator follow my custom routes?
Edit:
Here is my $paginator code that is in the view.
$paginator->options(array(
'update' => '#products',
'url' => array('controller'=>'Products','action'=>'index','pass'=>$this->params['pass']),
'evalScripts' => true,
'before' => $this->Js->get('#busy-indicator')->effect('fadeIn', array('buffer' => false)),
'complete' => $this->Js->get('#busy-indicator')->effect('fadeOut', array('buffer' => false)),
));
echo $paginator->prev("Prev",$this->passedArgs);
echo $paginator->numbers(array('separator'=>' '));
echo $paginator->next("Next",$this->passedArgs);