I would try something like this: rows_per_page = 20 # this should be set to whatever the 'paginate' parm is set to on your call to SQLFORM.grid - default is 20 page_number = int(query).count() / rows_per_page ) + 1 # 'query' should be the same query that you pass to SQLFORM.grid
redirect(URL('voltrin_data',vars={'page':page_number),user_signature=True) NOT TESTED!! Let me know if this doesn't work and I'll code up a test of my own to see what happens. Anyone have a more efficient way of doing this? -Jim On Tuesday, May 27, 2014 11:32:28 AM UTC-5, Tom Russell wrote: > > Jim, > > Yes I have a grid page in place which is where I go now. The grid though > has a lot of records and I just want to go to that last record in that > grid. Since its pagination thats what I am looking for, is how to go to the > last page in the grid. > > On Tuesday, May 27, 2014 12:17:02 PM UTC-4, Jim S wrote: >> >> When you say that you want to go to the 'grid' page, do you mean a page >> with a SQLFORM.grid on it and you want to go into 'edit' mode on a specific >> record on the grid? >> >> -Jim >> >> >> On Tuesday, May 27, 2014 10:42:31 AM UTC-5, Tom Russell wrote: >>> >>> I have a simple form where I have a submit button that runs some code. >>> After the code runs and the data is inserted into my table I do a simple >>> redirect like so: >>> >>> redirect(URL('voltrin_data')) >>> >>> That just goes to a page I have set up with a grid. I notice if I am >>> editing a record and press submit the next page that gets redirected to is >>> the last record in the grid. >>> >>> What I want to do is redirect to my grid but go to the page with the >>> l;ast entry and not the first page. >>> >>> How would I do that? I looked in the book but could not see how I would >>> do this. >>> >>> Thanks, >>> >>> Tom >>> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.