PDA

View Full Version : How to change tooltip text on a toolbar button



dbadke
1 May 2007, 11:50 AM
I have been unable to find any easy way to change the tooltip text for a toolbar button dynamically, after the button is created. I tried:

var btn = toolbar.addButton({tooltip: 'Initial text', ... });

...

btn.tooltip = 'New text';

The button's tooltip property changes, but the button over popup text does not.

After a long search through Button.js, I found how it does it, and came up with this:

btn.el.child('button:first').dom.qtip = 'New text';

which works, though I don't understand exactly what it is doing, don't entirely trust it to keep working, and think it a bit extreme just to change the text. :s

Am I missing a simple way to do this?

jsakalos
1 May 2007, 12:26 PM
Look for doc and maybe source of Ext.QuickTips.

dbadke
1 May 2007, 1:52 PM
I have looked at the documentation, and at the source, and the forums. I found nothing.

If you know of a specific reference I should look at, please tell me where it is! /:)

jsakalos
1 May 2007, 3:23 PM
Sorry, I don't have other method. I think there is no other chance as to do it as you describe until Ext team adds a setTooltip() method.

msubbareddy
3 Jun 2011, 7:05 AM
I was using the following way, but, some times works and some times not.


Ext.QuickTips.init();
...
buttonRef.getEl().set({qtip:btnText}); //not working always
So, I got use the this way to update the tooltip dynamically-



buttonRef.el.child('button:first').dom.qtip = 'new text'; //good to update tooltip dynamically


Nice, just tried the setTooltip() method and its also working, and its my first option over above two ways.

--
Subba Reddy