Here is a dynamic and flexible way to do it:
Code:
Ext.define('MyTabpanel', {
extend : 'Ext.tab.Panel',
xtype : 'mytabpanel',
config : {
home : true,
browse : true,
more : true
},
applyHome : function (home) {
if (home) {
home = {
xtype : 'home'
};
}
return home;
},
applyBrowse : function (browse) {
if (browse) {
browse = {
xtype : 'browse'
};
}
return browse;
},
applyMore : function (more) {
if (more) {
more = {
xtype : 'more'
};
}
return more;
},
updateHome : function (newHome, oldHome) {
if (oldHome) {
this.remove(oldHome);
}
if (newHome) {
this.add(newHome);
}
},
updateBrowse : function (newBrowse, oldBrowse) {
if (oldBrowse) {
this.remove(oldBrowse);
}
if (newBrowse) {
this.add(newBrowse);
}
},
updateMore : function (newMore, oldMore) {
if (oldMore) {
this.remove(oldMore);
}
if (newMore) {
this.add(newMore);
}
}
});
Now you can configure it at startup to not show each separately:
Code:
new MyTabpanel({
browse : false
});
That will show home and more but not browse. Or you can do it after:
Code:
var mytabpanel = Ext.ComponentQuery.query('mytabpanel')[0];
mytabpanel.setHome(false);
That will remove the home tab but leave the others alone.
Btw, this is the power of the config system and reason why we use it in ST2