I am developing a large enterprise application and I need to lazy load modules (another ExtJs applications) into a main application. I am trying to load app.js of other applications with Ext.Loader:
onTabChange: function (tabPanel, newCard, oldCard) {
Ext.Loader.loadScript({
url: 'SecondaryApp/app.js',
onLoad: function (obj) {
console.log('ok');
},
onError: function (obj) {
console.log('ko');
},
scope: this
});
newCard.add({ xtype: 'secondarylist' });
}
The callback it's ok but when I add the secondarylist component an exception of "Uncaught Error: [Ext.create] Unrecognized class name / alias: widget.secondarylist" is being thrown. The component is:
Ext.define('SecondaryApp.view.main.List', {
extend: 'Ext.grid.Panel',
xtype: 'secondarylist',
title: 'Personnel',
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Email', dataIndex: 'email', flex: 1 },
{ text: 'Phone', dataIndex: 'phone', flex: 1 }
]
});
I tried to compile and load the List.js only but I have the same problem anyway. Any suggestions?
EDIT: I solved the issue (bad url '-_-) but now have another issue. If I load the js file it works properly but if I try to load the compiled js file (with Sencha Cmd) it fails because Ext.cmd is undefined. I need to load the compiled js and not the original js file. Any ideas?