PDA

View Full Version : Is it ID always required?



crysfel
1 Nov 2011, 11:36 AM
Hi Folks.

I'm extending the tab panel with the following 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:



var main = Ext.create("Bleext.layout.view.MainTabs");
Ext.Viewport.add(main);


Unfortunately I'm getting this error:



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:


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

mitchellsimoens
1 Nov 2011, 12:58 PM
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:


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);

}
});