-
13 Feb 2012 3:36 AM #1
parseNamespace error occurs when preparing application for deployment
parseNamespace error occurs when preparing application for deployment
Hi,
I am using the SDK tools for preparing a deployment version of my application and have run into an issue where part of my application breaks and I get the following error message from sencha-touch.js:
Uncaught TypeError: Cannot call method 'substring' of undefined
In the stack trace the last call made is:
Ext.ClassManager.parseNamespace
This occurs when tapping on a button which creates and displays a new view from a controller as follows:
If I switch sencha-touch-debug.js back into my application, this error does not appear and the view displays as expected when tapping on my button.Code:'mainview #btnUserPrefs': { tap: function(btn) { if(this.getApplication().userPrefsPanel==null) { this.getApplication().userPrefsPanel = Ext.create('PinpointersTouch.view.PreferencesView',{ }); } Ext.Viewport.setActiveItem(this.getApplication().userPrefsPanel); this.getApplication().lastActiveView = 'prefsview'; } }
Any ideas why this may be happening?
-
13 Feb 2012 5:29 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
Is the PinpointersTouch.view.PreferencesView already loaded? Or is it dynamically loaded? The debug version of sencha touch has Ext.Loader enabled but sencha-touch.js does not.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
13 Feb 2012 7:44 AM #3
I thought it would have been loaded already as I have used the SDK tool to create an app-all.js file and I can see the PreferencesView code in there, so surely that means it has loaded?
I have a tab panel as my main view, and its being referenced in the requires config object as follows:
I guess I am misunderstanding something here?Code:Ext.define('PinpointersTouch.view.MainView', { extend: 'Ext.tab.Panel', xtype: 'mainview', requires: [ 'PinpointersTouch.view.LoginView', 'PinpointersTouch.view.UnitList', 'PinpointersTouch.view.GMapContainer', 'PinpointersTouch.view.PreferencesView', 'PinpointersTouch.view.History' ], config: { fullscreen: true, tabBar : { docked : 'bottom', layout : { pack : 'center' } }, items: [ { xtype: 'gmapcontainer', title: 'Map', iconCls: 'maps', iconMask: true },{ xtype: 'unitslist', title: 'Locations', iconCls: 'locate', iconMask: true },{ xtype: 'historyview', title: 'History', iconCls: 'time', iconMask: true }, { xtype: 'toolbar', docked: 'top', ui: 'light', itemId: 'topToolbarMain', defaults: { iconMask: true }, items: [ { xtype: 'label', html: 'Current Locations', style: 'color:white;', itemId: 'labelTopToolbarTitle'}, { xtype: 'spacer' }, { iconCls: 'refresh', itemId: 'btnRefresh' }, { iconCls: 'user', itemId: 'btnUserLogout' }, { iconCls: 'settings', itemId: 'btnUserPrefs' } ] } ], masked: { xtype:'loadmask', message: 'Please Wait' } } });
-
13 Feb 2012 9:56 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28
If memory serves me correctly, I think you need to figure out if the views are *defined* before your class is instantiated.
If memory serves properly:
There is a difference between uses and requires. I believe "uses" will instruct the SDK tools to include the /required/ classes before this one. Requires just invokes a load, and /required/ classes will typically be defined *after* this class.
Try using "uses" instead of "requires". See if that fixes it. If it does, please update the basecamp page

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
13 Feb 2012 11:02 AM #5Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
requires will make those classes loaded before the class being defined is defined. uses does not guarantee the classes are loaded even before they are instantiated.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
13 Feb 2012 2:37 PM #6Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
Are you seeing any console warnings mentioning dynamically loaded classes when you use debug? If you are you'll need to add those to your array of required classes
Ext JS Senior Software Architect
Personal Blog: http://edspencer.net
Twitter: http://twitter.com/edspencer
Github: http://github.com/edspencer
-
14 Feb 2012 2:05 AM #7
Ed,
That was exactly it, I had a fieldset warning when using the debug version as I have a couple being used on the view that I was trying to display. But I had not put the Ext.form.fieldset into a requires block at the top of my view definition.
After doing this, and rebuilding my file, its all working just fine!
I'll know to pay closer attention to such warnings next time around.
Thanks guys
-
14 Feb 2012 11:17 AM #8Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
Glad to hear that

I'll look into ways we can make it easier to diagnose this - the builder should really just tell you what's wrongExt JS Senior Software Architect
Personal Blog: http://edspencer.net
Twitter: http://twitter.com/edspencer
Github: http://github.com/edspencer


Reply With Quote