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

相關問題