I use the code below to cleanup some stuff if the user leaves the page before doing some things i expected:
window.onbeforeunload = function(){ if (UnsavedCards > 0){CleanUpOnPageExit();} } You could clear the flag at this point with an ajax call. ___________________________ *www.TenOutOfTen.org* <https://www.TenOutOfTen.org> rogers...@gmail.com (+95) 09 250018669 (Myanmar) On Wed, 25 Nov 2020 at 21:50, Vid Ogris <vid.og...@gmail.com> wrote: > Yeah I tried to do that... so I have records and there is a fields with 3 > options as T (true),F (false),P(pending) > > When the user starts to edit I set status to P and the SQLgrid does not > list this record for other users (SELECT * From table where filed = 'F'). > The problem is if the user click on the back button I cannot change the > status back to F, so the record would be listed again. > > Any ideas how to do that? > > V V sre., 25. nov. 2020 ob 12:39 je oseba AGRogers <rogers...@gmail.com> > napisala: > >> I am not aware that web2py has anything built in to do that. And it is a >> tricky task - to do it properly you need all sorts of real time feedback >> going to every grid that is already opened. It's conceptually not too hard >> for grids that will be opened in the future - just set a flag when someone >> starts to edit a record and clear it when they finish. But you would need >> to do that yourself. >> >> One thing that makes this problem worse (ie one user >> overwriting another user's change) is that web2py writes *every* field in >> the form to the database even if the user only changed a single field. So >> even if two users edit two different fields of the same record, the last >> person to save the record will overwrite all fields with their data - the >> one they changed (good) and the ones they didnt change (bad) >> >> ___________________________ >> *www.TenOutOfTen.org* <https://www.TenOutOfTen.org> >> rogers...@gmail.com >> (+95) 09 250018669 (Myanmar) >> >> >> >> On Wed, 25 Nov 2020 at 19:40, Yebach <vid.og...@gmail.com> wrote: >> >>> Hello, >>> >>> how can I lock a record in a table (SQLform.grid) when somebody is >>> editing one record so that other users cannot see it or it is grayed out or >>> smth. >>> >>> Is there already an web2py ways or do I have to create a new filed set >>> it as temp lock etc... >>> >>> thank you >>> >>> best regards. >>> >>> >>> -- >>> 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. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/web2py/461d3292-f56d-4773-80c3-2926f3b6f079n%40googlegroups.com >>> <https://groups.google.com/d/msgid/web2py/461d3292-f56d-4773-80c3-2926f3b6f079n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> 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 a topic in the >> Google Groups "web2py-users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/web2py/r1Gy87kRcmE/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> web2py+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/web2py/CACWMBMNf34RWRJNm407G_O_PWqo1g2TdmcjX_9Ov%2B3_KeiHOuA%40mail.gmail.com >> <https://groups.google.com/d/msgid/web2py/CACWMBMNf34RWRJNm407G_O_PWqo1g2TdmcjX_9Ov%2B3_KeiHOuA%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > Lep pozdrav > > Vid Ogris > > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/CAPek6tKM%2BwUsCy6vMKy6HuRVeP8u_-8DitG4UMe7g0QLzRFfSw%40mail.gmail.com > <https://groups.google.com/d/msgid/web2py/CAPek6tKM%2BwUsCy6vMKy6HuRVeP8u_-8DitG4UMe7g0QLzRFfSw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CACWMBMM1GG4h4QpZs4YqKWCV5Fb8zz1H%3DbjqS8%3DZOWH0O8YdSQ%40mail.gmail.com.