按钮工具提示extjs

时间:2010-12-08 13:44:49

标签: button extjs tooltip extjs3

我已通过调用

向中心区域的标签面板添加了一个按钮
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');

3 个答案:

答案 0 :(得分:7)

您需要初始化工具提示才能使其正常工作:

Ext.QuickTips.init();

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

答案 1 :(得分:3)

也适用于我(在ExtJS 4.1上):

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

答案 2 :(得分:1)

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

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