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.