On Thursday, April 11, 2019 at 2:03:00 PM UTC-4, João Matos wrote:
>
> 'll check out the db.mytable._before_delete callback.
>
> You said
> " I would probably simply disable the "delete" checkbox in the edit form
> (via editargs=dict(deletable=False)
> ), and only allow deletion via the grid buttons (which you can then
> intercept via the ondelete callback)."
>
> ondelete works but has a drawback (at least I couldn't figure out a
> solution). It works fine if what we have to do doesn't require a
> redirection to another page. If it does, it doesn't work.
>
Deletes via the grid buttons happen via Ajax, so you need a client-side
redirect:
def ondelete(table, id):
redirect(URL(...), client_side=True)
Anthony
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.