Datamapper pagination: total rows and current rows - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Datamapper pagination: total rows and current rows (/showthread.php?tid=27849) |
Datamapper pagination: total rows and current rows - El Forum - 02-22-2010 [eluser]Wazzu[/eluser] Hi all, I-m having troubles using DMZ pagination. I have 15 records and want to show 10 records per page. As you can see below, I make use of $o=>count to check how many records I have found Later I want to narrow that search so I can get just some of them, so I call $o->limit(10, $page)->get() but in this case, all my previous wheres and likes are gone. How can I get the total number of rows within the filter and then paginate them using the same query parameters? Code: // User list Datamapper pagination: total rows and current rows - El Forum - 02-22-2010 [eluser]jeffpeck[/eluser] Maybe they can be stored in session data? Datamapper pagination: total rows and current rows - El Forum - 02-22-2010 [eluser]Wazzu[/eluser] There must be some way to reuse previous $o->where and $o->like. I can use another local variable, without using session space, but Im sure there is something I could use :-( Datamapper pagination: total rows and current rows - El Forum - 02-23-2010 [eluser]Wazzu[/eluser] The bad news: you can't reuse your query after a count or a get call The good news: you can get a clone and use it for count, so your real object keeps all clausules. Found the answer at: http://ellislab.com/forums/viewthread/136039/P250/ (check from post #253) Documentation here: http://www.overzealous.com/dmz/pages/clonecopy.html |