存储保存失败时的Extjs回滚模型更改
我使用的是ExtJS4.0.7,我试图找到在保存失败时回滚模型更改的方法 我的店是存储保存失败时的Extjs回滚模型更改,extjs,rollback,Extjs,Rollback,我使用的是ExtJS4.0.7,我试图找到在保存失败时回滚模型更改的方法 我的店是 Ext.define('TEST.store.TestStore',{ extend: 'Ext.data.Store', storeId: 'testStore', model: 'TEST.model.TestModel', autoLoad: false, proxy: { type: 'rest', url: 'some/api',
Ext.define('TEST.store.TestStore',{
extend: 'Ext.data.Store',
storeId: 'testStore',
model: 'TEST.model.TestModel',
autoLoad: false,
proxy: {
type: 'rest',
url: 'some/api',
reader: 'json'
}
});
...
var me=this,
testStore = me.getStore('TEST.store.TestStore');
me.test = testStore.getAt(0);
//here are I am changing it
me.test.save({
failure: function(record,operation) {
console.log(test);
test.reject();
console.log(test);
}
});
但拒绝是行不通的。是否有其他方法可以清除此模型?
谢谢在ExtJS5中,方法是store.rejectChanges 如果它在v4中是reject,那么您可能需要在存储中调用它,而不是在记录中调用它,例如testStore.reject;在上面的代码中