Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

button tooltip extjs

I have added a button to a tab panel in the center region by calling

var add = tabSelection.addButton({
  id            : 'add',
  text          : 'Add',
  hidden        : true,
  tooltip       : 'Please highlight the correct value and click Add to create new contact',
  handler       : addContact
});

There are two radio buttons in the west region in an accordion layout, labeled 'internal' and 'external'. I want the tool tip to be changed dynamically by capturing the radio button click.

I am able to capture the radio button click and when I set the tooltip of the button accordingly, add.setToolTip('Please highlight the correct value and click Add to create new internalcontact'); if internal client is clicked. add.setToolTip('Please highlight the correct value and click Add to create new external contact'); when external is clicked.

like image 509
EXTJS newbie Avatar asked Dec 08 '10 13:12

EXTJS newbie


People also ask

How to add tooltip to Button in Extjs?

var tooltips = [{ target: 'guestButton', html: 'A very simple tooltip' }]; Ext. each(tooltips, function(config) { Ext. create('Ext. tip.

What is tooltip in Extjs?

ToolTip is a Ext. tip. Tip implementation that handles the common case of displaying a tooltip when hovering over a certain element or elements on the page. It allows fine-grained control over the tooltip's alignment relative to the target element or mouse, and the timing of when it is automatically shown and hidden.


3 Answers

You need to initialise tooltips for it to work:

Ext.QuickTips.init();

And use qtip instead of tooltip.

like image 113
Jan Vladimir Mostert Avatar answered Sep 20 '22 09:09

Jan Vladimir Mostert


Also worked for me (on ExtJS 4.1):

Ext.getCmp('buttonId').setTooltip('Tooltip you want to insert');
like image 42
chico2069 Avatar answered Sep 24 '22 09:09

chico2069


Another solution without using id, for e.g. with a button tooltip:

 var prev_button = new Ext.button.Button({
            cls: 'prevButton',
            listeners: {
                mouseover: function(btn) {
                    btn.setTooltip('1 ' + granularity.getValue()
                                   + ' ' + _('before'));
                }
            }
        });
like image 23
ivy Avatar answered Sep 21 '22 09:09

ivy