PDA

View Full Version : Can you change a closable tab to not be closable?



ShatyUT
15 Feb 2010, 9:30 AM
The question:
Can a closable tab be dynamically made to be not closable?

I did my best to search the forums directly as well as Google but couldn't find the answer.

The background:
I've got a tab panel to which tabs can be dynamically added by the user. I want these tabs to initially be closable so that if the user mistakenly added the tab they can correct this but the tab will contain a form and once they start answering questions on the form, I want to remove the ability to close the tab. I don't see a setClosable(boolean) method on TabPanel so I'm guessing the answer is no but want to make sure.

Can this be done or do I just need to find a way to intercept the close event of the tab and prevent it if necessary? I'd rather just remove the little 'X' if possible and would prefer to use provided methods.

fay
15 Feb 2010, 9:44 AM
Ext.fly(tabPanel.getTabEl(tabItem)).removeClass('x-tab-strip-closable');

ShatyUT
15 Feb 2010, 9:49 AM
That worked. Thanks! I guess I need to figure out the benefits of the Ext.fly() method...