PDA

View Full Version : How to avoid namespace errors, when app folder structure differs from standard ExtJS



xjscrafter
12 May 2014, 8:08 AM
BTW, for some reason, the forum tools don't appear for me (I'm using Chrome), so that's why I can't format my code.We have an ExtJS 4.2.1 app. The app builds fine with Sencha Cmd, and seems to run fine as well, but I'm getting a bunch of warnings like this one:[W] Missing namespace for com.atlas.screen.MyAppController1, please define it in namespaces property of your Application class.We have this folder structure, which differs from the standard ExtJS folder structure:app - com - atlas - screen - MyAppController1.js - MyAppController2.js - base - screen - MyBaseController1.js - MyBaseController2.jsHere is the top of my app.js file:Ext.Loader.setConfig({ enabled : true, paths : { "com" : "com", "Ext.ux" : "lib/src/ux" }});Ext.application({ name: 'AMC', namespaces: [ 'com.atlas.screen', 'com.base.screen' ], appFolder: 'com', controllers: [ 'com.atlas.screen.MyAppController1', ...

xjscrafter
12 May 2014, 8:39 AM
I tried to wrap my post in [CODE] but now it looks worse.

xjscrafter
12 May 2014, 9:04 AM
BTW, the tools are missing for me in Firefox and IE as well.

Gary Schlosberg
13 May 2014, 1:26 PM
CODE tags should only go around your code rather than the entire post. As far as your not seeing the htmleditor, let's keep that discussion on your other thread:
http://www.sencha.com/forum/showthread.php?285443

I tried looking at the file structure in your post but the formatting is not there to convey the hierarchy. Can you repost?

xjscrafter
3 Jun 2014, 4:32 PM
We have an ExtJS 4.2.1 app. The app builds fine with Sencha Cmd, and seems to run fine as well, but I'm getting a bunch of warnings like this one:

[W] Missing namespace for com.atlas.screen.MyAppController1, please define it in namespaces property of your Application class.

We have this folder structure, which differs from the standard ExtJS folder structure:


app
- com
- atlas
- screen
- MyAppController1.js
- MyAppController2.js
- base
- screen
- MyBaseController1.js
- MyBaseController2.js

Here is the top of my app.js file:


Ext.Loader.setConfig({
enabled : true,
paths : {
"com" : "com",
"Ext.ux" : "lib/src/ux"
}});

Ext.application({
name: 'AMC',
namespaces: [
'com.atlas.screen',
'com.base.screen'
],
appFolder: 'com',
controllers: [
'com.atlas.screen.MyAppController1', ...

xjscrafter
14 Aug 2014, 8:08 AM
Any help on this?

xjscrafter
14 Aug 2014, 8:35 AM
Getting lots of namespace warnings, tried using namespaces config in Application definition, other things, no luck.

50020

xjscrafter
14 Aug 2014, 11:24 AM
sencha?

xjscrafter
14 Aug 2014, 4:15 PM
Can anyone provide insight?

xjscrafter
15 Aug 2014, 11:52 AM
Can anyone provide insight?

chamacs
16 Aug 2014, 6:36 AM
We have this folder structure, which differs from the standard ExtJS folder structure:


app
- com
- atlas
- screen
- MyAppController1.js
- MyAppController2.js
- base
- screen
- MyBaseController1.js
- MyBaseController2.js


Is the structure you listed a typo? ' app' and '-com' isn't correct.
You define this in your app: appFolder: 'com',

so the structure should be (ie. no 'app' folder level):

com
- altas
...
- base
...

xjscrafter
16 Aug 2014, 10:25 AM
That's just formatting for the post. The app works fine, I just don't want these warnings.

chamacs
16 Aug 2014, 12:18 PM
Ext.Loader.setConfig({
enabled : true,
paths : {
"com" : "com",
"Ext.ux" : "lib/src/ux"
}});

Ext.application({
name: 'AMC',
namespaces: [
'com.atlas.screen',
'com.base.screen'
],
appFolder: 'com',
controllers: [
'com.atlas.screen.MyAppController1', ...



So you're saying the 'app' and 'com' folders exist at the same level? And you're not using the 'app' folder for your source? I think that your defined 'namespaces' are supposed to be those that exist outside your 'app namespace'. I think you're seeing the error because you're overlapping you're 'app namespace' with your 'custom namespace' because of your appFolder configuration. The error message comes from the Controller class' onClassExtend() method. Try changing your appFolder to something other than 'com':


appFolder: 'app'

Just a theory....

daviddayag
13 Apr 2016, 7:55 AM
Just add the "name" property with identical value to both Application class and th instantiation of the Application class.

Ext.define('Karambit.Application', { name:'ReligionSucks',};
var application = new Ext.application({ name:'ReligionSucks'}