【发布时间】:2019-03-09 07:07:30
【问题描述】:
在开发应用程序时,我会在应用程序启动时运行一些代码:
Ext.application({
extend: 'TestApp.Application',
name: 'TestApp',
requires: [
'TestApp.*'
],
// The name of the initial view to create.
launch: async function () {
const store_org = Ext.getStore('Organizations');
const store_event = Ext.getStore('Events');
//more stuff here
}
});
两个商店的定义都很好:
Ext.define('TestApp.store.Organization', {
extend: 'Ext.data.Store',
storeId: 'Organizations',
alias: 'store.organizations',
model: 'TestApp.model.Organization',
autoLoad: true,
pageSize: 0,
proxy: {
type: 'ajax',
url: TestApp.util.Config.getHost() + '/organization/get-organizations',
withCredentials: true,
reader: {
type: 'json',
rootProperty: '',
},
},
});
但是我确实注意到,在启动 Ext.getStore() 函数时,对于任何商店,总是返回 undefined。有什么办法可以将其“延迟”到 storemanager 已完全加载并且这些商店不再返回 undefined 的程度? (存储本身不会被数据填充......)。
【问题讨论】:
标签: javascript extjs store extjs6-modern