ExtJS 4 Ext.application 要求
ExtJS 4 Ext.application requires
这是我的文件夹结构:
- 应用程序(文件夹)
- 控制器(文件夹)
- 模型(文件夹)
- 存储(文件夹)
- utils(文件夹)
- 查看(文件夹)
- Settings.js(文件)
- 数据(文件夹)
- docs(文件夹)
- ext-4(文件夹)
- 资源(文件夹)
- setigns(文件夹)
- Settings.js(文件)
- app.js(文件)
- file.html(文件)
这是我的 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();
}
});
这是我的 Settings.js 代码:
Ext.define('MyApp.Settings', {
singleton: true,
settingKey2: 'settingValue2',
settinglocale: 'es',
(here are more variables)
}
在 app.js 中,在需要选项中我加载了应用程序文件夹中的 Settings.js 文件,但我不知道如何加载设置文件夹中的文件而不是一个在应用程序文件夹中。
Settings.js 两个文件如上代码
您可以尝试使用 Ext.Loader.setPath
。
最简单且符合标准的方法是将您的设置定义为 MyApp.settings.Settings
,然后使用
Ext.Loader.setPath('MyApp.settings', 'settings');
Ext.require('MyApp.settings.Settings');
或者,您可以使用 Ext.Loader.loadScript
并提供路径和文件名。
这是我的文件夹结构:
- 应用程序(文件夹)
- 控制器(文件夹)
- 模型(文件夹)
- 存储(文件夹)
- utils(文件夹)
- 查看(文件夹)
- Settings.js(文件)
- 数据(文件夹)
- docs(文件夹)
- ext-4(文件夹)
- 资源(文件夹)
- setigns(文件夹)
- Settings.js(文件)
- app.js(文件)
- file.html(文件)
这是我的 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();
}
});
这是我的 Settings.js 代码:
Ext.define('MyApp.Settings', {
singleton: true,
settingKey2: 'settingValue2',
settinglocale: 'es',
(here are more variables)
}
在 app.js 中,在需要选项中我加载了应用程序文件夹中的 Settings.js 文件,但我不知道如何加载设置文件夹中的文件而不是一个在应用程序文件夹中。 Settings.js 两个文件如上代码
您可以尝试使用 Ext.Loader.setPath
。
最简单且符合标准的方法是将您的设置定义为 MyApp.settings.Settings
,然后使用
Ext.Loader.setPath('MyApp.settings', 'settings');
Ext.require('MyApp.settings.Settings');
或者,您可以使用 Ext.Loader.loadScript
并提供路径和文件名。