Extjs4显示禁用按钮的工具提示

问题描述:

当我禁用按钮时,它的工具提示也会禁用。有没有办法显示工具提示,即使按钮被禁用。Extjs4显示禁用按钮的工具提示

//create my button 
     var myButton = Ext.create('Ext.Button', { 
      tooltip : 'my Button Tooltip Text', 
      id : 'my-button ', 
      iconCls : 'star-icon', 
      handler: Ext.Function.pass(_rmp.mediaManager.myButtonFunction, this) 
     }); 

//disable my button 
    Ext.getCmp('my-button').disable(); 

编辑: 如预期在Firefox(我使用8.0.1版本)其他浏览器(Chrome浏览器,Safari浏览器,Opera)的提示按预期工作这是行不通的。

@jeewiya

默认情况下,ExtJS的框架,显示了禁用按钮的工具提示。下面是我对我的Reset按钮什么:

{ 
     text: 'Reset', 
     tooltip : 'my Button Tooltip Text', 
      id : 'my-button ', 
     handler: function() { 
      this.up('form').getForm().reset(); 
     } 
} 

而且,下图显示了 Tooltip on disabled button

在情况下,你想试试我的样品尖端甚至出现后复位按钮被禁用,这里是我用ExtJS 4.0.7测试的完整代码,并且按预期工作:

Ext.onReady(function(){ 

Ext.tip.QuickTipManager.init(); 

var form = Ext.create('Ext.form.Panel', { 

    renderTo: Ext.getBody(), 

    title: 'Simple Form', 
    bodyPadding: 5, 
    width: 350, 

    layout: 'anchor', 
    defaults: { 
     anchor: '100%' 
    }, 

    // The fields 
    defaultType: 'textfield', 
    items: [{ 
     fieldLabel: 'First Name', 
     name: 'first', 
     allowBlank: false 
    },{ 
     fieldLabel: 'Last Name', 
     name: 'last', 
     allowBlank: false 
    }], 

    // Reset and Submit buttons 
    buttons: [{ 
     text: 'Reset', 
     tooltip : 'my Button Tooltip Text', 
     id : 'my-button ', 
     handler: function() { 
      this.up('form').getForm().reset(); 
     } 
    }, { 
     text: 'Submit', 
     formBind: true, 
     disabled: true, 
     handler: function() { 
      Ext.getCmp('my-button ').disable(); 
     } 
    }], 
    renderTo: Ext.getBody() 
}); 



}); 
+0

嗨,感谢您的帮助。但我仍然无法解决问题。我使用你的代码创建了一个jsfiddle,但它在其他浏览器(chrome,safari,opera)上的firefox(我正在使用8.0.1版本)不能按预期工作。我也测试了我的代码,发现它不能在firefox上工作 – jeewiya 2012-01-10 05:44:39

+0

这是Firefox中的一个错误 - https://bugzilla.mozilla.org/show_bug.cgi?id=274626和Target Milestone被称为mozilla8,所以我们将预计这会随时出现。 – 2012-01-10 08:45:29