Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
存储保存失败时的Extjs回滚模型更改_Extjs_Rollback - Fatal编程技术网

存储保存失败时的Extjs回滚模型更改

存储保存失败时的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',

我使用的是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',
        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;在上面的代码中