Extjs4 - easiest way to enable / disable tabs in tabpanel?

Is there an easy way to enable / disable tabs in tabpanel at runtime?

At the moment, I:

Ext.getCmp('thetabpanel).getTabBar().items.get(1).setDisabled(true); 

This seems very complicated, but I cannot find any obvious method at the level of the tab bar to do this directly.

thanks

+4
source share
3 answers

You can use the method to get the tab,

 Ext.getCmp('thetabppanel').down('#itemIdForTheTab').setDisabled(true); 

check documentation for http://dev.sencha.com/deploy/ext-4.0.2a/docs/#/api/Ext.tab.Panel-method-down

+2
source

You can access the items property (the witch is MixedCollection) and use the getAt() method:

 Ext.getCmp('thetabpanel').items.getAt(1).setDisabled(true); 

See link documentation

edit: typos

+1
source

You can also use the new query functions:

 var panel = Ext.ComponentQuery.query('thetabpanel panel[id="#itemIdForTheTab"]')[0]; panel.setDisabled(true); 

See the Ext API on ComponentQuery for more details.

+1
source

All Articles