Using PaginateDataGrid, I stumbled over a probably common problem. In my 
PaginateDataGrid I have an edit link in the last column that allows me 
to edit a data record in the grid. When you click on the link, you will 
get a form with the data and after submitting the form, you will be 
redirected to the data grid again. However, when you return to the 
datagrid, the paginate mechanism has forgotten its page and lists page 1 
again instead of the page with the edited record.

Are there any best practices for keeping the paginate state?

* One idea is putting the paginate state parameters in the edit link, 
let the edit form put it in hidden fields, and then add these parameters 
when you redirect to the grid again. Should work, but is a bit 
cumbersomely. Maybe a decorator @paginate(pass_state=True) that pops the 
parameters from the query parameters and adds them as a dict to the 
template var may somewhat simplify this, though not fully automatize.

* Another idea is storing the paginate state (per controller) in the 
cherrypy session and using this state whenever a paginated controller is 
called. Again, a decorator @paginate(keep_state=True) that does this 
automatically would be very helpful. Needs cookies, though.

Opinions? I am willing to implement one of these ideas in TG if we can 
agree which is the best.

-- Christoph

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to