Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
465
How do I completely remove a row without undo using Javascript
posted

Hi, I would like to completely remove a row from a WebDataGrid so it no longer displays in the grid even though the post back has not occurred yet. Right now the row is just grayed and crossed out and there is a undo button placed over the row. I want it to disappear completely.

 

Here is my current JS:

 

 

function DeleteSelectedRows() {     var WebDataGrid1 = $find("WebDataGrid1");

    var rows = WebDataGrid1.get_rows();

     for (i = 0; i < rows.get_length() ; i++) {

         var row = rows.get_row(i);

         var checked = row.get_cell(0).get_value();

         if (checked) {

             rows.remove(row);

         }

     }

 }

Parents
No Data
Reply
  • 15320
    Offline posted

    Hello Bart,

    Thank you for posting in our community.

    Did you enable the BatchUpdating property of the EditingCore? If you did, then you should note that you can modify (edit, add, delete) multiple rows at once until post back occurs. Therefore when you attempt to delete rows on the client, the respective row to be deleted is only crossed with a line and at the left side of the row there is "Undo" button.

    If you want to prevent this, you should set BatchUpdating property to false.

    Another important thing is also that deleting of row on the client would be persisted if the data source that you're using supports auto CRUD operations. Otherwise you should handle the RowDeleting server side event and handle the deleted rows manually.

    Attached is a sample with similar scenario for your reference.

    Please let me know if you need any further assistance.

    Sincerely,

    Tsanna

    WDGDeleteRowsClient.zip
Children