2010-12-08 96 views
5

我已经通过调用按钮工具提示的ExtJS

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 
}); 

,我们在以手风琴布局西部地区两个单选按钮,标记添加一个按钮,在中心区域中的标签面板“内部”和“外部” 。我希望通过捕获单选按钮单击来动态更改工具提示。

我可以捕捉单选按钮,并在相应地设置按钮的工具提示时, add.setToolTip('Please highlight the correct value and click Add to create new internalcontact');如果内部客户端被点击。 add.setToolTip('Please highlight the correct value and click Add to create new external contact');单击外部时。

+0

你可以重新说明这一点或提供更多的信息?很难确定你是否在这里问一个问题。 – owlness 2010-12-09 07:55:48

回答

7

您需要初始化工具提示,它的工作:

Ext.QuickTips.init(); 

而且使用qtip而不是工具提示。

+0

如果你在一个应用程序中使用QuickTips,你会把这个文件放在什么文件中? – Merchako 2016-04-18 18:57:49

3

还曾为我(在ExtJS的4.1):

Ext.getCmp('buttonId').setTooltip('Tooltip you want to insert'); 
1

不使用的ID,用于例如另一种解决方案与一个按钮工具提示:

var prev_button = new Ext.button.Button({ 
      cls: 'prevButton', 
      listeners: { 
       mouseover: function(btn) { 
        btn.setTooltip('1 ' + granularity.getValue() 
            + ' ' + _('before')); 
       } 
      } 
     });