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
360
How to reset/discard all changes in the grid without a post-back?
posted

Hello!

 

In our application, BatchUpdate is enabled, and a user can add and edit rows as he wish. If he now leaves the current sub-page containing the grid, we check if such changes exist via JavaScript (by using grid.get_behaviors().get_editingCore().get_addedRows() for instance).

The problem now is: If the user didn't save, a dialog pops up asking whether he wants to discard the changes or go back. If he chooses to discard the changes, I wonder how I can manage this, preferably in JavaScript, since a postback will immediately triggersavingthe data instead, which I don't want to happen. Is there a way to reroll the grid to a point before the changes?

 

I tried emptying the get_addedRows() and get_editedRows() array, but that doesn't work at all as I wish. Deleting the addedRows manually via grid.get_rows().remove(addedRows[index]) doesn't work either, because then the row isn't actually deleted because of the BatchUpdating, but just marked for deletion (although RowDeleting isn't even enabled^^, so a postback after this wouldn't even know how to handle that case).

 

Do you have any ideas/suggestions what I could do to get this behavior? Last resort I could think of would be to store some JavaScript value in a hidden field, which I would then access on postback and tell the OnRowAdding/OnRowUpdating handlers "don't do anything!".

 

Thanks!