Search code examples
extjs4

Dynamically change ToolTip of a Tool object


Is there a way to change a tooltip text from a Tool placed in a panel? I looked at the ToolTip object and QuickTip but neither have a function like setTipText()

Thanks, Y_Y


Solution

  • I have two solutions for your problem!

    1. Change HTML-attribute

      toolTip=Ext.ComponentQuery.query('tooltip[itemId=myToolTip]')[0];
      toolTip.html = "This is the new text!";
      toolTip.setTitle("new Title");
      toolTip.render();
      
    2. Destroy the old one and make a new one...

      tooltip.destroy();
      var config = {
          target: 'bottomCallout',
          anchor: 'top',
          anchorOffset: 85, // center the anchor on the tooltip
          html: "Fancy new ToolTip with a totally different config..."
      };
      Ext.create('Ext.tip.ToolTip', config);