最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - add a tooltip to an EXTJS Button - Stack Overflow

programmeradmin4浏览0评论

I am trying to add a tooltip to my button, I tried differents ways, but nothing happen when i put the mouse under the button, this is a part of my code when i tried to add this tool tip this when i created the button called guestButton

 {
    xtype : 'button',
    id : 'guestButton',
    text : 'Guest User',
    handleMouseEvents: true,
    width : 80,
    x : 70,
    y : 150,
    formBind : false,                       
    handler : function() {
    this.up().LoginGuest();
    }

and here when i tried to create the tooltip

    var tooltips = [{
            target: 'guestButton',
            html: 'A very simple tooltip'
        }];
Ext.each(tooltips, function(config) {
        Ext.create('Ext.tip.ToolTip', config);
    });  

Ext.QuickTips.init();

Thanks !

I am trying to add a tooltip to my button, I tried differents ways, but nothing happen when i put the mouse under the button, this is a part of my code when i tried to add this tool tip this when i created the button called guestButton

 {
    xtype : 'button',
    id : 'guestButton',
    text : 'Guest User',
    handleMouseEvents: true,
    width : 80,
    x : 70,
    y : 150,
    formBind : false,                       
    handler : function() {
    this.up().LoginGuest();
    }

and here when i tried to create the tooltip

    var tooltips = [{
            target: 'guestButton',
            html: 'A very simple tooltip'
        }];
Ext.each(tooltips, function(config) {
        Ext.create('Ext.tip.ToolTip', config);
    });  

Ext.QuickTips.init();

Thanks !

Share Improve this question asked May 9, 2017 at 16:27 AhmedAhmed 1692 gold badges4 silver badges13 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 7

Another way of adding tooltips at render.
@chrisuae is right , but it had not worked for me also.
What worked was creating tooltip on render of element :

   {
        xtype : 'textareafield', 
        grow : true,
        fieldLabel : 'E-Mail-Adressess'
        itemId : 'email',
        afterLabelTextTpl : required,
        allowBlank : false,
        listeners : {
            render: function(c) {
            Ext.create('Ext.tip.ToolTip', {
                target: c.getEl(),
                html: 'You can enter multiple emails here'
            });
           }    
        }
    }

You should be able to define a tooltip for a button in ExtJS using:

xtype : 'button',
id : 'guestButton',
text : 'Guest User',
tooltip: 'A very simple tooltip',

If your button is disabled, the tooltip will not show. This is by design, but if you need to, you can override it with some CSS:

.x-item-disabled, .x-item-disabled * {
    pointer-events:all;
}

See fiddle here.

Thanks for your answers, I simply deleted this line handleMouseEvents: true, magically it works

发布评论

评论列表(0)

  1. 暂无评论