CodeIgniter Forums
codeigniter pagination sorting one page - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: codeigniter pagination sorting one page (/showthread.php?tid=65281)



codeigniter pagination sorting one page - vladakg - 05-24-2016

Hi,

I got one task to done, but I don't have idea how to do. I use Codeigniter 2.x, and I need to read data from mysql and list in one table, table should have pagination and sorting possibility, but sorting should be only on one page. For instance, if data has 15 records and we will list all data with 5 records per page we will have 3 pages. 1 page - 1,2,3,4,5 2 page - 6,7,8,9,10 3 page - 11,12,13,14,15

And my question is if I am on page number 2, and I click reverse sorting to get result 10,9,8,7,6. On first page to get result 5,4,3,2,1 On third page to get result 15,14,13,12,11

I know how to reverse all query but I need only reverse per page, does anyone know how?

Thanks in advance


RE: codeigniter pagination sorting one page - abhijeetgk - 05-24-2016

may be you can run regular paging query with default sorting and before displaying in table you can again sort depending on your need.