Welcome Guest, Not a member yet? Register   Sign In
How to maintain sorted search results in paging?
#1

[eluser]lsalsich[/eluser]
Hello all,

Thanks in advance for any help you can offer. I have a page in my application which displays all data from a certain table. These results are paged by 20. However, I also have added code to allow the data display to be sorted by each column header. This works ok.

The problem is that the data sort is lost when moving from one page to the next. I've reviewed how to add custom data to the sessions class, but how do I add this session data to the paging URL?

For example, a sorted page URL looks like this: http://www.testsite.com/account/admin.ph...t/asc/date

However,the URL for the 'Next' page is http://www.testsite.com/account/admin.php/task/tasks/20

So, I've lost the sort data.

How do I add this session data to the paging URL? Is there another method you would recommend?

Thanks!
#2

[eluser]rjsmith[/eluser]
You can use variables in your controller method to keep track of the sorting, and send that data to your view to append to the link(s).
#3

[eluser]lsalsich[/eluser]
[quote author="rjsmith" date="1360623725"]You can use variables in your controller method to keep track of the sorting, and send that data to your view to append to the link(s).[/quote]

Thanks. I guess my question is 'how' do I add these variables to links which are generated by the Paging class? I've ready through the paging class documentation and I can't see anywhere to put custom variables.
#4

[eluser]rjsmith[/eluser]
You didn't mention you were using the paging class. Every write your own library before? You may either have to roll your own pagination, or extend the existing one.




Theme © iAndrew 2016 - Forum software by © MyBB