function onButtonClick(){
var grid = Ext.getCmp('mygridpanel')
var row = grid.getSelectionModel().getSelection()[0];
var txtVehicleID = Ext.getCmp('txtVehicleID').getValue();
var txtPlat_No = Ext.getCmp('txtPlat_No').getValue();
console.log(txtVehicleID);
var record = UserStore.findRecord('_id', txtVehicleID);
record.set('_id', txtVehicleID);
record.set('Plat_No',txtPlat_No);
UserStore.sync({
success: function(batch) {
Ext.MessageBox.show({
title: "Information",
msg: batch.operations[0].request.scope.reader.jsonData["message"],
icon: Ext.MessageBox.INFO,
buttons: Ext.MessageBox.OK,
fn: function(buttonId) {
if (buttonId === "ok") {
EditWin.close();
}
}
});
},
failure: function(batch){
Ext.MessageBox.show({
title: "Error",
msg: batch.operations[0].request.scope.reader.jsonData["message"],
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn: function(buttonId) {
if (buttonId === "ok") {
// Call back at here
EditWin.close();
}
}
});
}
});
//console.log("clicked");
}
store.sync失败后如何回调?
答案 0 :(得分:1)
UserStore.rejectChanges();
请参阅http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Store-method-rejectChanges