1. #1
    Sencha User
    Join Date
    Jun 2009
    Posts
    410
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default 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:

    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';
        }
    }
    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.

    Any ideas why this may be happening?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,073
    Vote Rating
    854
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jun 2009
    Posts
    410
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    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:

    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'
    			
    		}
        }
    });
    I guess I am misunderstanding something here?

  4. #4
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,360
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    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

  5. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,073
    Vote Rating
    854
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  6. #6
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    9
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    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

  7. #7
    Sencha User
    Join Date
    Jun 2009
    Posts
    410
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    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

  8. #8
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    9
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    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 wrong
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer