PDA

View Full Version : Removing the Closable Property of a Tab



dreamcaster
3 Nov 2010, 6:50 AM
Hello Experts,

I just want to ask how do you remove the closable property of a tab's component?

Thanks.

plalx
3 Nov 2010, 6:58 AM
Removing the closeable property?
If you want to prevent tabs to get closed you can add closable: false as a config option on the tabs.

E.g.



new Ext.TabPanel({ items: [ { title: 'tab1', closable: false} ]}, ...);

dreamcaster
3 Nov 2010, 7:59 AM
Hi scarsick. Thanks for your reply but that's not the answer.
I need to remove the closable property programmatically. However, there is no 'setClosable()' public method provided in all components with closable property.

Condor
3 Nov 2010, 8:03 AM
var tab = tabPanel.getComponent(2); // tab 2
var el = tabPanel.getTabEl(tab);
Ext.fly(el).removeClass('x-tab-strip-closable');

dreamcaster
3 Nov 2010, 8:13 AM
var tab = tabPanel.getComponent(2); // tab 2
var el = tabPanel.getTabEl(tab);
Ext.fly(el).removeClass('x-tab-strip-closable');

Hi Condor! Thanks for the solution. :-)
I wonder why ExtJS people doesn't include any setClosable public method.

dlygagnon
14 Jan 2015, 10:21 PM
I was also looking for a better solution. It would have been nice if there was a function on the TabPanel that allows to set closable to true or false, instead of only providing the config param closable.

Is there a better solution?

Thanks in advance!