Extjs4 动态更改工具对象的工具提示

Extjs4 动态更改工具对象的工具提示,extjs4,Extjs4,是否有方法从放置在面板中的工具更改工具提示文本?我查看了ToolTip对象和QuickTip,但它们都没有像setTiptText()这样的函数 谢谢你,你的问题我有两个解决办法 更改HTML属性 toolTip=Ext.ComponentQuery.query('tooltip[itemId=myToolTip]')[0]; toolTip.html = "This is the new text!"; toolTip.setTitle("new Title"); toolTip.render

是否有方法从放置在面板中的工具更改工具提示文本?我查看了ToolTip对象和QuickTip,但它们都没有像setTiptText()这样的函数


谢谢你,你的问题我有两个解决办法

  • 更改HTML属性

    toolTip=Ext.ComponentQuery.query('tooltip[itemId=myToolTip]')[0];
    toolTip.html = "This is the new text!";
    toolTip.setTitle("new Title");
    toolTip.render();
    
  • 摧毁旧的,创造一个新的

    tooltip.destroy();
    var config = {
        target: 'bottomCallout',
        anchor: 'top',
        anchorOffset: 85, // center the anchor on the tooltip
        html: "Fancy new ToolTip with a totally different config..."
    };
    Ext.create('Ext.tip.ToolTip', config);
    

  • 我有两种解决你问题的方法

  • 更改HTML属性

    toolTip=Ext.ComponentQuery.query('tooltip[itemId=myToolTip]')[0];
    toolTip.html = "This is the new text!";
    toolTip.setTitle("new Title");
    toolTip.render();
    
  • 摧毁旧的,创造一个新的

    tooltip.destroy();
    var config = {
        target: 'bottomCallout',
        anchor: 'top',
        anchorOffset: 85, // center the anchor on the tooltip
        html: "Fancy new ToolTip with a totally different config..."
    };
    Ext.create('Ext.tip.ToolTip', config);
    

  • 我无法在工具提示上添加itemId,因此我可以通过以下方式动态更新工具提示:

    var toolTip = Ext.get(tool.getEl().id + '-toolEl');
    toolTip.set({ 
        'data-qtitle': 'New Tooltip Title', //this line is optional
        'data-qtip': 'Updated Tool Tip!' 
    });
    

    我无法在工具提示上添加itemId,因此我可以通过以下方式动态更新工具提示:

    var toolTip = Ext.get(tool.getEl().id + '-toolEl');
    toolTip.set({ 
        'data-qtitle': 'New Tooltip Title', //this line is optional
        'data-qtip': 'Updated Tool Tip!' 
    });
    

    我尝试了第一种解决方案,它似乎起了作用。但由于某种原因,我没有看到新的文本。看起来我需要以某种方式刷新具有工具提示的工具。有什么想法吗?你是对的,第一个不正确。。。我已经更新了!你必须调用render()方法和setTitle()方法(如果你首先有一个标题集的话)。但由于某种原因,我没有看到新的文本。看起来我需要以某种方式刷新具有工具提示的工具。有什么想法吗?你是对的,第一个不正确。。。我已经更新了!您必须调用render()方法和setTitle()方法(如果您首先设置了标题)。您可以使用“标题”:“更新的工具提示!”如果需要其他类型的工具提示,可以使用“标题”:“更新的工具提示!”如果需要其他类型的工具提示。