SensacionRC
SensacionRC

Reputation: 615

ExtJS 4 Ext.application requires

This is my folder structure:

This is my app.js code:

Ext.application({
name: 'MyApp'           
,appFolder: 'app'           
,requires: [
        'MyApp.Settings'
]
,stores:['strFichaCredenciales', 'strClientes']
,controllers: [  'ctrlMenuPrincipal'
                ,'ctrlArbolOrganigrama'
                ,'ctrlFichaCredenciales'
                ,'ctrlOfertasComerciales' ]
,autoCreateViewport: true
,init: function() {
        this.splashscreen = Ext.getBody().mask('CArgando aplicacion', 'splashscreen');
}
,launch: function() {
    Ext.getBody().unmask();
if (MyApp.Settings.dsplg)
    Ext.ComponentManager.get('viewDespliegue').show();      
else
    Ext.ComponentManager.get('viewDespliegue').hide();  
if (MyApp.Settings.in18)
    Ext.ComponentManager.get('ComboTraslation').show(); 
else
    Ext.ComponentManager.get('ComboTraslation').hide(); 
}
});

This is my Settings.js code:

Ext.define('MyApp.Settings', {
singleton: true,
settingKey2: 'settingValue2',
settinglocale: 'es',
(here are more variables)
}

In app.js, in requires option I´m loading the Settings.js file that is in the app folder, but i don´t know how to load the one in settings folder intead of the one in app folder. Both Settings.js files are as the code above.

Upvotes: 1

Views: 377

Answers (1)

Alexander
Alexander

Reputation: 20244

You can try around with Ext.Loader.setPath.

The easiest and standard-conforming way would be to define your settings as MyApp.settings.Settings and then use

Ext.Loader.setPath('MyApp.settings', 'settings');
Ext.require('MyApp.settings.Settings');

Alternatively, you can use Ext.Loader.loadScript and provide the path and file name.

Upvotes: 2

Related Questions