0

我有一个商店CurrentStore,用于将用户输入的数据存储到表单中。当用户按下“与服务器同步”按钮时,我希望将数据移出当前存储并存入HistoryStore,并将其推送到服务器。我该怎么去?Sencha Touch:更改商店中所有记录的值

的商店:

App.stores.CurrentStore = new Ext.data.Store ({ 
model : 'ExpenseReport', 
sorters: [{ 
    property: 'date', 
    direction: 'DESC' 
}], 
autoLoad : true, 
autoSave : true 
}); 

的型号:

BReimb.models.Expense = Ext.regModel('Expense', { 
fields : [ 
    { name : 'id', type : 'integer'}, 
    { name : 'categ', type : 'string'}, 
    { name : 'cost', type : 'auto'}, 
    { name : 'date', type : 'date'}, 
    { name : 'desc', type : 'string'}, 
    { name : 'paymeth', type : 'string'}, 
    { name : 'userlogged', type : 'string'}, 
    { name : 'synced', type : 'string', defaultValue: 'no'} 
], 
proxy : { 
    type : 'localstorage', 
    id : 'user-reimb' 
} 
}); 

我在工具栏上一个简单的按钮与空处理功能的,现在我想用同步的商店和外部服务器数据库我该怎么办 ??

回答

1

,你必须使用

proxy:{ 
    type:'ajax', 
    url:' your remot server url', 
    reader: { 
      type: 'json', 
      root: 'results' 
     } 

}, 

和你的店是jsonStore

相关问题