PDA

View Full Version : Revert data after get error in server when cell editing



dranix
30 Oct 2011, 8:29 PM
Hello everybody.
I'm coding a grid with cell edit, using Ext.grid.EditorGridPanel. After editing a cell, user press "Enter", and object send to server. If the server return false (invalid validation), I want the data stays unmodified, not the invalid data.

Currently, my solution is store the data before it's sent to server, then check the error, if false, data will be reverted by selecting each row and manually set value to them.

I think it's common problem, but I can't find any better solution. I wonder if there's any option in EditorGridPanel to set revert mode on. Could anyone help me on this problem

Thank in advance!

darthwes
31 Oct 2011, 11:53 AM
Natively supported by ExtJS. Records have the method "reject" to reject changes to a single row. Stores have the method "rejectChanges" which rejects all the changes in the entire store. Happy hunting.

dranix
31 Oct 2011, 6:58 PM
Thank you
It's totally working