I need to restore(set value to before edited value) edited grid cell value in edit function, not in validateedit function.
"orderList": {
validateedit: function (plugin, edit) {
//validate...
},
edit: function (plugin, edit) {
Ext.MessageBox.confirm('Confirm', 'Are you sure to change this order status?', function (btn) {
if (btn == 'yes') {
//update
} else {
// I want to rollback!
edit.cancel = true;
edit.record.data[edit.field] = edit.originalValue; //it does not work
}
});
}
}
How to change the grid cell value (editor)?
Thanks!
How about the reject method:
"orderList": {
validateedit: function (plugin, edit) {
//validate...
},
edit: function (plugin, edit) {
Ext.MessageBox.confirm('Confirm', 'Are you sure to change this order status?', function (btn) {
if (btn == 'yes') {
//update
} else {
edit.record.reject(); // this should revert all changes
}
});
}
}
Also note that the second argument (the one you named "edit") of the edit
event does not contain a cancel
property, that is a property of the beforeedit
event. So this line edit.cancel = true
won't do anything for you.
I was also curious why you aren't using the beforeedit
event, it seems more ideally suited for this kind of thing - that it why it does have that cancel
property.