I'm struggling a little bit with the notion of updating an index list via ajax vs. reloading the entire page.
I guess I can see how it would be a better user experience to use ':eval' to just update the displayed rows and informational stuff like 'rows 40 through 60 of 237' or 'page 3 of 13.' Doing it this way the browser doesn't have to fetch again the javascript, css and image files, so it will seem more immediate. But isn't there a risk of a race condition because of the asynchronous updates? What happens if the user clicks the delete button and immediately clicks the next page link? Thanks Cliff Kachinske On Thursday, May 24, 2012 6:23:58 PM UTC-4, Niphlod wrote: > > well, the intended design is NOT to reload page if a row is deleted > (better user experience). > Small corner cases are "delete every row in the page and be "forced" to > click on next page to have new records", etc..... > > Anyway, you can intercept delete operations.... > > deletable = request.vars.stoptoyingaround and False or True > if request.args(0) == 'delete': > if db(db.parameter).count() <= 1: > response.flash = 'deleting the last row is not allowed' > redirect(URL('yoururl', vars=dict(stoptoyingaround=1))) > ....... > > caveat: if you're using the "args" argument to SQLFORM.grid() 'delete' > would be the first arg after the "base" ones. > > if you like to have your users to play with the delete button when there > is 1 row left (and not harm your database while playing), you can skip the > deletable assignement based on request.vars. > As a nice side effect, you can count your table only when it's needed ;-) > > >