Hi again, I'm trying to put together simple item paginators (ala the http://framework.zend.com/manual/en/zend.paginator.usage.html example), and I'm just wondering what the best practice for something like this is when used with the Dojo grid. The Dojo grid takes care of the search pagination, so all we really need after that is item pagination, but it seems to be a pretty manual job to get that working in this context.
Basically, the best way I've come up with so far to do this is as follows: 1. user browses the grid / conducts a search on the grid, which triggers the controller's list action 2. list action instances the model, the model hits the db, and retrieves the rows for the grid. 3. the model instances the paginator and stores it in a session 4. the user eventually selects a row from the grid, which triggers the display action 5. display action checks the session, and passes the last stored session paginator on to the view for displaying There's a couple of obvious problems, the main one being searches will get clobbered if the user conducts more than one at once, which can be avoided by a token in the URL or something, but even if you solve that, there's still some PHP-type problems, and I haven't really got a clean way around them yet. Basically, it seems cleanest to just instance the paginator in the model, because the $select is right there, you've applied all your criteria to it, it's perfect to pass on to the paginator factory right there and then, except... it doesn't work. You can't serialize a PDO object, so you can't keep the thing around long enough to get it in to a view. Well, using sessions at least. So far I've worked on using Zend_Paginator_Adaptor_Null and controlling it all manually with URL variables, which is possible, but it sounds pretty clunky, and really doesn't sound like what I'd call a "best practice" for this. DbSelect is out and Array probably won't help things much. So has anyone done this / got any good ideas? What would be beautiful if we could simplify item paginators down to as simple as they are with search paginators, something like $this->view->paginator = Zend_Paginator::factory($select);.