Results 1 to 2 of 2

Thread: Is it ID always required?

  1. #1
    Sencha User crysfel's Avatar
    Join Date
    Feb 2008
    Location
    New York, USA
    Posts
    218
    Vote Rating
    9
      0  

    Default Is it ID always required?

    Hi Folks.

    I'm extending the tab panel with the following code:

    Code:
    Ext.define("Bleext.layout.view.MainTabs",{
    	extend		: "Ext.tab.Panel",
    	
    	config		: {
    		tabBarPosition	: "bottom",
    		items			: [{
    			title	: "Test",
    			iconCls	: "home"
    		}]
    	}
    });
    And when I want to create an instance of that class I do this:

    Code:
    var main = Ext.create("Bleext.layout.view.MainTabs");
    Ext.Viewport.add(main);
    Unfortunately I'm getting this error:

    Code:
    Uncaught Error: [ERROR][Bleext.layout.view.MainTabs#getObservableId] Invalid unique id of 'ext-bleext.layout.view.maintabsview-1' for this object
    But if I add an "ID" when creating the class it works fine:
    Code:
    var main = Ext.create("Bleext.layout.view.MainTabs",{id : Ext.id()});
    Ext.Viewport.add(main);
    The thing is that I dont like to work with ID's, does anyone know why is this happening? is it required to always assign an ID to all instances of one class?

    Regards

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,369
    Vote Rating
    1514
      0  

    Default

    Quote Originally Posted by crysfel View Post
    The thing is that I dont like to work with ID's
    Good practice not to touch the id config...

    I'm not getting any error from doing this:

    Code:
    Ext.define("Bleext.layout.view.MainTabs",{
    	extend		: "Ext.tab.Panel",
    
    	config		: {
    		tabBarPosition	: "bottom",
    		items			: [{
    			title	: "Test",
    			iconCls	: "home"
    		}]
    	}
    });
    
    Ext.setup({
        onReady: function() {
    
    var main = Ext.create("Bleext.layout.view.MainTabs");
    Ext.Viewport.add(main);
    
        }
    });
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •