Editable Table - Disable delete for first row

Editable Table - Disable delete for first row

  

Hi,

I am using editable table in my web app.

On delete action, i shouldn't allow the first row to be deleted.

In Delete action i have checked the count, if its less than one, i am not deleting the row.



I checked the database the row is not deleted.

But in screen i am getting the below error.


Solution

Hi,

The front end side i did it using CSS. its working fine. Is there any better approach to do that?

SyntaxEditor Code Snippet

.EditableTable > tbody > tr:first-child +
.RowControlGroup .DeleteRowAction{
    display: none;
}
Solution

Hello Sekar,

May i ask what id are you passing to the DeleteElectric_Tariffs_Rates?

From my understanding, you have a table with "n" rows with a DELETE button/link associated to each one, am i correct?

Or do you have like a DELETE button/link to delete all the records except the first one? If so, you have to run a cycle to delete each record of the list you are passing to the table except the first one.



Hi Sekar,


The CSS will hide the button but you should also be preventing the Delete inside your Screen Action.

For this case you can probably check the EditableTable list variables directly without needing to the Refresh Query.


In the Screen Action use the Current, CurrentRowNumber and BOF variables to check whether the user is trying to delete the first record (see attachment).

We just had a similar problem using the Editable Table widget, the problem happens when you use Ajax Refresh on the table.

Try removing the refresh from your action and see if you still get the problem.