While developping an application I run some code on application launch:
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
}
});
Both stores are well defined:
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: '',
},
},
});
I do notice however that while launching the Ext.getStore()
function always returns undefined
for any store. Is there any way I can "delay" this to the point where the storemanager has fully loaded and these stores do no longer return undefined? (The stores themselves won't be filled with data...).
Just add this to the Ext.application class or to the TestApp.application (which is better)
stores:['TestApp.store.Organization'],
this is an array of all your stores,so if you need to add more just use a comma and write the class path name of the new file
Here is a working example Fiddle