View Full Version : Update the tooltip on a tab panel if you only have access the tabs content component

17 Jun 2013, 3:49 AM
As I managed to figure out the answer before I posted the question, I'll just write post my problem and how I solved if anyone else runs into the problem.
In my program I have a scenario where I first create a placeholder panel that I add to a tabpanel. The problem I have is that when the real report that I then replace the placeholder with is created it also contains a tooltip that I wan't to apply to the tab button in the tab bar. Updating the title is easy, there is a setTitle() method in the panel that will fire a 'titlechange' event that will be picked up by the tab in the tabbar and update the tabs title, but there are no equivalent setTooltip() method. There is a setTooltip() method in the tab (Ext.tab.Tab) but it's not obvious how to get the tab if you only have the panel that is the content of the tab. Getting the tab bar is easy using the getTabbar() method on the tab panel but I haven't found a way to figure out which tab is connected to a specific panel so that doesn't help.

Anyway, I managed to solve my problem and it turned out to be easy but could made much more obvious (unless I've been blind and missed the method that does this already). The solution is that the tab panel adds a property to the component that you add to it, the property is named tab and using this object you can do setTooltip(). This code seems to be the same in both 4.1 and 4.2 (but I have only tested it in 4.2.1).

18 Jun 2013, 3:17 PM
Thanks for sharing your trials / successes with the community!