I have followed the CakeBook to create Ajax based pagination. The Links are all working, the routes are working because it is sending the request to the correct action on the controller. I am getting the relevant page number in my controller action and I am then sending it to the Paginate helper to fetch the data. But that only ever returns the first page of results irrespective of the page being set. So I did an override of the paginate function on the model and sure enough I am always getting the page set to 1.
Controller Action code..
public function reviews(){
if ($this->RequestHandler->isAjax()) {
if(!empty($this->params['page'])) {
$review = $this->Page->find('first', array('conditions'=>array('friendly'=>'reviews')));
$this->layout = 'ajax';
$this->paginate = array(
'page' => $this->params['page'],
'limit' => 3,
'order' => array(
'Review.rating'=>'desc')
);
$reviews = $this->paginate('Review');
$this->set(compact('review','reviews'));
}
}
}
So how do I get the Paginator to use my page that I am sending it?