Sencha Touch 2:
这是我的商店定义
var incidentsJson = loadJson();
Ext.define("App.store.EventsFeed", {
extend: "Ext.data.Store",
requires: ['Ext.data.proxy.JsonP'],
config: {
listeners: {
beforeload: function() {
console.log('before store load');
return true;
},
load: function(store, records) {
console.log(' store loaded', records);
}
},
model: 'App.model.Incident',
autoLoad: true,
data: incidentsJson,
reader: {
type: 'json',
}
}
});
数据已加载但load()
和beforeload()
没有被调用,发生了什么?
答案 0 :(得分:0)
beforeload必须在“config”之外。
示例:
var incidentsJson = loadJson();
Ext.define("App.store.EventsFeed", {
extend: "Ext.data.Store",
requires: ['Ext.data.proxy.JsonP'],
listeners: {
beforeload: function() {
console.log('before store load');
return true;
},
load: function(store, records) {
console.log(' store loaded', records);
}
},
config: {
model: 'App.model.Incident',
autoLoad: true,
data: incidentsJson,
reader: {
type: 'json',
}
}
});