We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

undo row delete (clear)

Grid is not connected to data. A row is selected. On key up I test for the delete key and message box pop up to confirm. On cancel, I would like to restore the contents of the row. How can I do a "CurrentRow.CancelEdit" type behavior

3 Replies

AD Administrator Syncfusion Team February 26, 2004 07:08 AM UTC

If you have grid.CommandStack.Enabled = true so the grid''s undo support is enabled, then you can use this to rollback changes. The idea would be to call grid.CommandStack.BeginTrans when you start editing on a new row. You could try this in teh CurrentCellStartEditing event, but you would have to have a row variable to track the row being edited so you would know when you were starting on a new row. Then when you leave the row (say in CurrentCellMoved) you would call grid.CommandStack.CommitTrans to end the undo/redo transaction. If your user cancels the edit in your delete key code, you would call grid.CommandStack.Rollback to undo the changes.


AD Administrator Syncfusion Team February 29, 2004 03:55 AM UTC

Using the commandstack sounds right, I''ve searched your web site and help files, but could not find sample code to demomstrating how to push and pop on the stack. Any sample code?


AD Administrator Syncfusion Team February 29, 2004 05:30 AM UTC

Check out this sample. It has a menu/toolbar entry that Begins/Commits transactions. Syncfusion\Essential Suite\Grid\Samples\In Depth\UndoRedoSample

Loader.
Live Chat Icon For mobile
Up arrow icon