5

我通过调用在中心区域的选项卡面板中添加了一个按钮

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');单击外部时。

4

3 回答 3

8

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

Ext.QuickTips.init();

并使用 qtip 代替工具提示。

于 2011-01-11T06:51:29.160 回答
3

也为我工作(在 ExtJS 4.1 上):

Ext.getCmp('buttonId').setTooltip('Tooltip you want to insert');
于 2012-08-21T14:09:21.927 回答
1

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

 var prev_button = new Ext.button.Button({
            cls: 'prevButton',
            listeners: {
                mouseover: function(btn) {
                    btn.setTooltip('1 ' + granularity.getValue()
                                   + ' ' + _('before'));
                }
            }
        });
于 2012-10-30T10:00:24.610 回答