Matthew,
I'm not super experienced with Paginator but... I think the options()
method of Paginator can pass in the queries from your previous url.
For example in my application I'm using a Helper to write my
pagination links and the action is a variable in the links but the
url's are non-standard. I'm doing this in my application:
$this->Paginator->options['url'] = array('action'=>$this-
>params['pname']);
$controls = "{$this->Paginator->prev('Previous')} | {$this-
>Paginator->numbers()} | {$this->Paginator->next()} <!-- THUMBNAIL
PAGE SET NAVIGATION LINKS -->";
Based on this success, I'm assuming you can pick the query out of
$this->params and inject them back in to Paginator with options() in
the same way.
Good luck
Don
On May 19, 11:14 am, Matthew McNaughton <[email protected]>
wrote:
> Hello World,
> I'm using cakePHP to build out an open data API in Jamaica (the first of
> its kinda here). Things have been going well thus far and I'm very happy
> with our decision. At the moment I am running into an issue with
> pagination.
>
> The basic problem is that I want to preserve the query passed to the
> view from the controller. At the moment when the user selects the
> default paginate the results for a particular query. Currently if you
> are on a page with a particular query:
> e.ghttp://localhost/agroProjects/api/crops?parish=st.andrew&district=blo...
>
> If I click the Next or Prev button it goes
> to:http://localhost/agroProjects/api/crops/index/page:2
>
> Which returns page two of the default query. Instead it should go
> to:http://localhost/agroProjects/api/crops/index/page:2?parish=st.andrew...
>
> I suspect it may be related to how I use the paginator helper in the
> View. The code is below
> <?php echo $this->Paginator->prev('<< ' . __('previous', true), array(),
> null, array('class'=>'disabled'));?>
> <?php echo $this->Paginator->numbers();?>
> <?php echo $this->Paginator->next(__('next', true) . ' >>', array(),
> null, array('class' => 'disabled'));?>
>
> Any help would be greatly appreciated.
>
> (i.e not return the 250,000 records for every time I receive a query).
> We decided to limit the results returned (for .
> $cropData = $this->paginate('Crop', $query);
>
> But the issue is that that when I click "Next Page" in the view it
> forgets the original query paramer
> --
> Regards,
> Matthew McNaughtonwww.twitter.com/mamcnaughton
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php