PDA

View Full Version : qtip



Dig4Fire
26 Sep 2009, 1:30 AM
Hello,

is it possible to show a qtip (text of a treenode) only if the treenode-text is not completly visible?

Thanks in advance

Animal
26 Sep 2009, 7:10 AM
You'll have to add up the widths of the constituent elements of the node's inner div. If the total with is greater than the TreePanel's width, then it overflows.

Dig4Fire
26 Sep 2009, 9:50 AM
Thank you, my problem now is how to receive the hover event? Can you point me in the right direction?

Animal
26 Sep 2009, 10:11 AM
A good way might be to use a single ToolTip instance on the TreePanel and use the delegate: '.x-tree-node-el'

Then in the beforeshow event see whether to show it or not by examining the width of the content and comparing it.

I think you can find the actual tree node by using the ext:tree-node-id attribute to look it up in the TreePanel

Dig4Fire
26 Sep 2009, 1:28 PM
I'm using your NodeMouseoverPlugin (http://www.extjs.com/forum/showthread.php?p=180375). Thx



listeners: {
mouseover: function (node) {
var el = Ext.get(node.getUI().getEl());
if (el.getTextWidth() > myTreePanel.getInnerWidth()) {
new Ext.ToolTip({
target: node.ui.elNode.id,
html: node.attributes.text
});
}
},