1
我是sencha touch應用程序開發的新手。我試圖從遠程服務器上加載一些數據到列表中。我創建瞭如下的商店:在sencha touch中註冊JSONm商店
Ext.regStore('customers',{
model : 'customer',
sorters : 'firstName',
storeId : 'customers',
data : [{
id : 100,
firstName : 'aaa'
}, {
id : 101,
firstName : 'sss'
}, {
id : 102,
firstName : 'rrrr'
}]
});
現在我需要修改這個店來檢索外部server.Follwoing數據是我使用現在的代碼
var customers = new Ext.data.JsonStore({
model : 'customer',
proxy : {
type : 'ajax',
url:'http:sample.com',
reader : {
type : 'json',
root : '',
},
},
listeners : {
datachanged : function() {
customers.each(function(r) {
console.log('data in record is:'+ r.get('name'));
});
}
},
});
現在我的疑問是,如何註冊這個JSON店像inital代碼從另一個視圖控制器文件訪問商店。
在此先感謝