EasyUI Forum
April 20, 2024, 06:52:54 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Is it possible to have tooltip on leaves or branches of a tree ?  (Read 7254 times)
forum6691
Newbie
*
Posts: 39


View Profile
« 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
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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>';
}
})
Logged
forum6691
Newbie
*
Posts: 39


View Profile
« Reply #2 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 ?
« Last Edit: April 06, 2014, 09:29:09 AM by forum6691 » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!