PDA

View Full Version : How to change a tabpanel title?



qiuyl
2 Dec 2006, 12:40 AM
I want to change a tabpanel's title (the text of a tab title) on the fly but failed. How can I do it quickly?

var activatedTab = tabs.getActiveTab();
activatedTab.text = 'title changed'; //no error but does not change
activatedTab.title = 'title changed'; //no error but does not change

I want to dynamicly update how many items (a grid loaded from database) in a tab. I want to have tab titles as

tab1-flowers (45 items) tab2-cloth (55 items) ......

Thank you!

Animal
2 Dec 2006, 3:15 AM
I'm sure I have code to do this at work. I'll post up a TabPanelItem method setTitle() on Monday.

jack.slocum
2 Dec 2006, 5:01 AM
activatedTab.setText('Foo');

I am updating the TabPanelItem docs and will publish it shortly.

twisted_pear
1 May 2011, 12:51 PM
I cooked up a simple DOM walking fix for the issue of not being able to update the title of a tab in a TabPanel once it has been rendered. I could not even find the methods mentioned in the other threads here, so I hope this helps others. If it has a different work around, my bad.

See Updating TabPanel Tab Title (http://www.lustforge.com/2011/05/01/update-extjs-tab-title/)

Oh, and why do I need this? I need to increment a number in the tab title to show the number of pending items for the user, which is a need others probably have too.