PDA

View Full Version : Ext.Loader with cross-domain paths



cjauvin
22 Nov 2013, 7:00 AM
I'd like to set up the loader of my application with two namespaces, one local and one external:



Ext.Loader.setConfig({
enabled: true,
paths: {
'Ext.ux': 'http://cdn.sencha.com/ext-4.1.1-gpl/examples/ux',
'Ext.ux.local': './extjs_extras'
}
});


Reading the doc, I'm not sure if such a setup is even possible, though this answer on Stack Overflow seems to imply that it is:

http://stackoverflow.com/a/17127284/787842

However, as I'm getting a "No 'Access-Control-Allow-Origin' header is present on the requested resource" (for 'Ext.ux.statusbar.StatusBar') error, there's clearly something wrong and I'd appreciate any help.

mitchellsimoens
3 Dec 2013, 1:13 PM
There are two modes Ext.Loader uses to load classes and that is async and sync requests. You need to always make sure you are using async as sync will use an Ajax call where async will use a <script> element and you can load cross domain via <script> elements. To always use async, you just need to require the classes, sync comes in where you are trying to create an instance but the class isn't loaded.