【发布时间】:2014-01-25 02:11:46
【问题描述】:
我有 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吗?
-
愚蠢的问题...但是您确定第二个商店已加载并实例化吗?
-
我使用 Architect 创建商店,我可以看到它已满载记录。我不确定它是否已实例化,但据我所知,我以前从未这样做过..或者我可能在不知情的情况下做到了。
-
您是从“第二组”中删除“s”还是打错字??
-
是的,我也注意到了,我将其更改为所有(商店、模型和 storeId)现在都具有相同的名称(第二组),但它仍然让我未定义..