Undo record delete in Grid

2 posts, 0 answers
  1. MarNar
    MarNar avatar
    1 posts
    Member since:
    Feb 2007

    Posted 26 Feb 2013 Link to this post


    I'm using a Kendo grid with MVC. The grid is in batch editing mode using Open Access.
    One of the requirements is the possibility to undo an accidental row delete while editing. The delete confirmation is not enough.
    When a user edits a lot of rows and accidentally deletes a row, the only option is to cancel the changes. However all changes in the grid are rolled back. 

    I have implemented a simple undo by hiding the row in the grid and saving the dataitem in a javascript queue.In a SaveChanges event I pop the remaining items on the undo queue and programmatically delete the items.

    However if the user changes the filter options of the grid the 'hidden' deleted rows become visible again as the filtering options also hides and unhides rows.

    Anyone have an idea for implementing a row undo that survives filtering and sorting ?

  2. Daniel
    Daniel avatar
    2219 posts

    Posted 28 Feb 2013 Link to this post

    Hello Marcel,

    You should use the Grid dataBound event to hide the rows again because the table rows will be redrawn. If you are deleting the rows with custom request you could also send the IDs as additional data to the server and filter the collection.

    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top