是否有一种方法可以从放置在面板中的工具更改工具提示文本?我查看了ToolTip对象和QuickTip,但它们都没有像setTipText()
这样的函数谢谢,Y_Y
我不能在我的工具提示上放置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!'
});
我有两个解决方案!
-
更改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);