这是我的商店MyStore.js
Ext.define('myProject.store.MyStore', {
config:{
storeId: 'MyStore',
autoLoad: false,
autoSync: false,
allowSingle: true,
clearOnPageLoad: true,
model: 'abc.model.MyStoreModel',
proxy: {
type: 'rest',
actionMethods: {create: 'POST', read: 'GET', update: 'POST', destroy: 'POST'},
url:'/services/rest/MyService/myService',
reader: {
type: 'json',
rootProperty:MyServiceView.elements.collection',
successProperty : 'success'
},
writer:
{
type: 'json',
root: 'MyServiceDataView',
nameProperty: 'mapping',
expandData : true
},
listeners: {
exception: function(proxy,response,operation){
}
}
}
}
});
这是我的模特
Ext.define( 'myProject.model.MyStoreModel', {
extend: 'Ext.data.Model',
config:{
idProperty: 'keyStr',
fields:[
{
name: 'keyStr',
type: 'string',
},
{
name: 'sId',
type: 'int'
},
{
name: 'dCode',
type: 'string'
},
{
name: 'sNumber',
type: 'int'
}
]
},
});
在Controller.js中,我有此方法
syncMyStore: function()
{
var myStore = Ext.getStore('MyStore');
var record = this.getRescordForStore(); //assume it is happening
myStore.insert(0, record);
if(this.isSyncRequires(myStore)) //assume this is always true
{
myStore.sync();
}
},
现在,成功同步后,记录仍然很脏:true; 怎么弄虚假?
PS:假设我的商店中有10条记录,那么同步触发了10个休息电话。我想使成功同步的记录变得肮脏。 我什至可以在一个成功呼叫的基础上删除记录。
请注意,同步过程中不会发生成功,失败和回调。
How to perform action on the basis of response status while doing sync in Ext.js