我有2个加载数据的商店。getStore(); undefined Sencha Touch 2
第一店:
Ext.define('Connecting.store.Groups', {
extend: 'Ext.data.Store',
requires: [
'Connecting.model.groupModel',
'Ext.data.proxy.Ajax',
'Ext.data.reader.Json'
],
config: {
autoLoad: true,
model: 'Connecting.model.groupModel',
storeId: 'Groups',
proxy: {
type: 'ajax',
url: 'http://localhost/php/getGroups.php',
reader: {
type: 'json'
}
}
}
});
二店:
Ext.define('Connecting.store.Secondgroups', {
extend: 'Ext.data.Store',
requires: [
'Connecting.model.Secondgroup',
'Ext.data.proxy.Ajax',
'Ext.data.reader.Json'
],
config: {
autoLoad: true,
model: 'Connecting.model.Secondgroup',
storeId: 'Secondgroup',
proxy: {
type: 'ajax',
url: 'http://localhost/php/getSecondGroup.php',
reader: {
type: 'json'
}
}
}
});
第一家店工程;
var store = Ext.getStore('Groups');
console.log(store);
但是,当我改变storeId
为“Secondgroup
”(在getStore)我console.log
会给我一个'undefined'
..
似乎不是我可以在发现问题..在什么方向有什么建议我必须看看?
PS。我正在使用Sencha Architect,但这不应该是一个问题。
你能设置一个jsfiddle吗? – lascort
愚蠢的问题......但你确定第二家商店加载和实例化? – arthurakay
我使用Architect来创建商店,并且我可以看到它完全加载了记录。我不确定它的实例化,但据我所知,我从来没有这样做过,或者我不知道它做到了。 –