CodeIgniter Forums
How to write permanently offset pagination value - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to write permanently offset pagination value (/showthread.php?tid=56877)



How to write permanently offset pagination value - El Forum - 01-27-2013

[eluser]Unknown[/eluser]
Hi there.

I have this scenario. I have a control panel from which I manage 4 tables in my database.

For each table I have a controller, a model and a view.
So for each table I have a CRUD.

In any CRUD there is a paging system and a sorting, based on the writing of the sort values ​​of the columns, in sessions.

When you are in one of the CRUD, I can keep the number of the page or column sorting even when I leave the URL to see the detail of the record and return to the view.

I noticed that when I go another CRUD for to work in another table, at return to the previous CRUD, keep sessions sorting, but I lose the offset. Pagination start from scratch.

I came to the conclusion, after several trials, the write offset should be carried out within the class Pagination, as this every time you load a controller recalculates the offset before you even get to the point where the session law the value previously written.

I wanted to know if anyone has an opinion or idea on how to properly save the offset value.

thanks


How to write permanently offset pagination value - El Forum - 01-27-2013

[eluser]Harold Villacorte[/eluser]
It is difficult to understand what the problem is here or how you are trying to implement pagination. All the pagination library does is generate a series of links based on the three parameters: base_url, total_rows, and per_page. It appends a uri segment to the base_url that you would pass to the method to use in the database query.