简体   繁体   English

ExtJS 4 Ext.application要求

[英]ExtJS 4 Ext.application requires

This is my folder structure: 这是我的文件夹结构:

  • app (folder) 应用程式(资料夹)
    • controller (folder) 控制器(文件夹)
    • model (folder) 模型(文件夹)
    • store (folder) 商店(文件夹)
    • utils (folder) utils(文件夹)
    • view (folder) 查看文件夹)
    • Settings.js (file) Settings.js(文件)
  • data (folder) 数据(文件夹)
  • docs (folder) docs(文件夹)
  • ext-4 (folder) ext-4(文件夹)
  • resources (folder) 资源(文件夹)
  • settigns (folder) settigns(文件夹)
    • Settings.js (file) Settings.js(文件)
  • app.js (file) app.js(文件)
  • file.html (file) file.html(文件)

This is my app.js code: 这是我的app.js代码:

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: 这是我的Settings.js代码:

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. 在app.js中,在require选项中,我正在加载app文件夹中的Settings.js文件,但是我不知道如何在app文件夹中加载一个在settings文件夹中。 Both Settings.js files are as the code above. 两个Settings.js文件均与上面的代码相同。

You can try around with Ext.Loader.setPath . 您可以尝试使用Ext.Loader.setPath

The easiest and standard-conforming way would be to define your settings as MyApp.settings.Settings and then use 最简单和符合标准的方法是将设置定义为MyApp.settings.Settings ,然后使用

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. 或者,您可以使用Ext.Loader.loadScript并提供路径和文件名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM