Reputation: 21249
Is there a simple way to enable/disable tabs in a tabpanel at runtime?
At the moment, I do:
Ext.getCmp('thetabpanel).getTabBar().items.get(1).setDisabled(true);
That seems really complicated, but I can't seem to find any obvious method at the tab panel level to do that directly.
Thanks
Upvotes: 5
Views: 16475
Reputation: 4483
You can use the method down to get the tab,
Ext.getCmp('thetabppanel').down('#itemIdForTheTab').setDisabled(true);
check the documentation for down http://dev.sencha.com/deploy/ext-4.0.2a/docs/#/api/Ext.tab.Panel-method-down
Upvotes: 3
Reputation: 98
You can access the items property (witch is a MixedCollection) and use the getAt()
method:
Ext.getCmp('thetabpanel').items.getAt(1).setDisabled(true);
See documentation link
edit:typos
Upvotes: 2
Reputation: 645
You could also use the new query features:
var panel = Ext.ComponentQuery.query('thetabpanel panel[id="#itemIdForTheTab"]')[0];
panel.setDisabled(true);
See the Ext API on ComponentQuery for more details.
Upvotes: 1