2010-12-08 101 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')); 
       } 
      } 
     });