0
votes

I'm displaying a bunch of database query results using the Paginator in a table in my view. I have a few pages of results. I've also added the ability to sort this data using this->Paginator->sort(), which also works fine.

The only issue is that if I go to the next page (eg page 2 from page 1), all the selected sort options are stripped from the URL. How can I tell the paginator to remember sort options between pages?

1
Use get method and pass those requests with your pagination too.urfusion
I guess you are talking about this issue.arilia
@Cellydy : how are your current sorting option working? is the param pass in url ?urfusion
@urfusion I figured it out, posted below. Thanks for steering me in the right direction.Cellydy

1 Answers

0
votes

Ok, I've figured it out. In my view I had to parse the sort parameters:

$this->Paginator->options(['url' => ['sort' => $this->request->query('sort'),'direction' => $this->request->query('direction')]]);

Thanks @urfusion for the tip!