Editable tables - cancel a delete row

Editable tables - cancel a delete row

Hi. I am trying to cancel a delete row operation on an Editable Table widget, based on some business logic.

Has anyone tried this before? I could not find anything in the forums, but this seems like such a simple use case...

Any help would be greatly appreciated. Thanks!
Leonardo Fernandes
Hi Leonardo,

What do you mean with "cancel a delete row operation"?
Not reaching the delete record action based on some logic validation prior to that, or just not allowing clicking a delete in the first place?
When the user clicks the trash icon, the row is immediately deleted from the client side, and a server side event is triggered (On Row Delete).
Inside this event, I can check, with some business logic, if the user is able or not to actually delete the row. So I can stop the delete on the database from happening.
Nevertheless, on the client side, the row still gets removed from the table. I want to prevent that.

I have already tried throwing an exception on the server side, refreshing the Editable Table while it still has all the rows, and some other dirty workarounds, but couldn't get anything acceptable to work.

Since the logic reaches teh "delete" i don't think it's possible to "revert".
My suggestion to prevent it, would first only let the trash icon available for those who has permissions to delete, either in terms of visibility, or in the action, checking user roles, and with a message validation to perform that action.
If you want to the trash icon visible to everyone, in the action build up some logic , and for some users roles, just a refresh to delete that row, for hiding it, instead of actualy deleting from server.
Just an ideia...

Andrew Tabata