delete rules on editable table

Hi, I have a problem concerning deleting items from an editable table.  I want to avoid a delete when the object being deleted has references to other records in the database (primary key violation on delete).  So I handle the 'On Row Delete' event and I check if there are problems with the delete.  If so, I want to avoid deletion of the object, so I don't call the delete statement of that object and go straight to end.  The problem is, the editable table will delete the item in the UI.  If I refresh the Source Record List or the editable table, an index out of range is thrown... and I'm stuck.  Is there a way to avoid deleting in the editable table when a problem occurs? It's very strange not to find any resources concerning this problem because it seems to me you want to be able to check things before deleting.

Thanks in advanced,


Hi Nico,

You can configure that in the attributes table delete rule:

This is enough for you?




Thanks for your reply.  The protect rule will avoid users to be deleted if there is a Technician with that specific UserId. (= expected behaviour of key references in a relational db)  So of cource, this is Ok.  So if one just calls the delete statement for a Technician in the 'on delete items' event of the editable table, an exception will be raised.... But in the editable table, the record will be gone. That's the problem!  If I then refresh the table to show ALL the items (of cource allso the item that has NOT been deleted), an index out of range exception is raised, it doesn't make sense.  I want to avoid the item to be removed from the table in the UI, or refresh the table after a cancelled delete (whatever the reason is for canceling the delete... exceptions, my own logic,..).  It doesn't make sense that I cannot give a message to the user that other actions need to be performed before deleting of the user is possible, and NOT delete the item from the UI.

I found a quick fix by replacing the end node of the delete logic with a destination to the same screen (so the entire screen gets refreshed).  This works but I don't want to refresh the entire screen, but just the editable table.

Hope this makes my problem clear




As a workaround, you can create a hidden button (with style as "display: none;") that you can call on the Action from the Editable Table's "On Row Delete" Event using the "Widget_Click" action. That button will allow you to do the Refresh Data and the Ajax Refresh that you want to use.



Sorry but this sounds verry 'hacky'.  And what do you mean by 'call the button' using the Widget-Click action?

I don't see how an extra button would prevent the index out of range exception when doing ajax refresh.  Calling the refresh action is no problem, the internal behaviour of the editable table on delete item is causing the problem. 

I meant using the "Widget_Click" Server Action from the RichWidgets to "force" a click on the button that does the Ajax Refresh.

As I said, this is just a workaround. There is some problem with the Ajax Refresh being called by the Editable Table's On Row Delete event. That is why I suggested you to call a button that does that Ajax Refresh. This is indeed very "hacky" but it does work. 

Edit: You can look at this solution on another post that looks like it has a similar problem. It was the one that I used as reference (since I used that workaround in the past) and I was just searching for it. Link: