EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: forum6691 on April 05, 2014, 11:37:24 PM



Title: Is it possible to have tooltip on leaves or branches of a tree ?
Post by: forum6691 on April 05, 2014, 11:37:24 PM
It seems interesting to can have some additionnal informations by tooltip when you move the mouse on the different leaves or branches of a tree.

Is it possible simply ?
Thanks


Title: Re: Is it possible to have tooltip on leaves or branches of a tree ?
Post by: stworthy on April 06, 2014, 07:23:52 AM
The simplest way to display tooltip information is to use 'formatter' function to set a node's 'title' attribute.
Code:
$('#tt').tree({
formatter:function(node){
return '<span title="' + node.text + '">' + node.text + '</span>';
}
})


Title: Re: Is it possible to have tooltip on leaves or branches of a tree ?
Post by: forum6691 on April 06, 2014, 09:05:54 AM
Excellent, thanks Sworthy.
May I use node.attributes to store the string for the tooltip when I create the tree with an array ?
Then I use your code modified
Code:
return '<span title="' + node.attributes+ '">' + node.text+ '</span>';

Question: can node.attributes store an array to store many informations on a branch of the tree ?