EasyUI Forum
May 03, 2024, 07:57:52 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: Tree formater  (Read 14334 times)
iceh
Jr. Member
**
Posts: 61


View Profile
« on: January 03, 2014, 07:17:18 AM »

Hi,

i use a custom formater for a tree:

Code:
            formatter: function (node) {
                var s = node.text;

                if (!node.attributes || !node.attributes.tooltip)
                    return s;

                if (node.attributes.tooltip) {
                    s = '<span title=\'' + node.attributes.tooltip + '\' class=\""easyui-tooltip\"">' + s + '</span>';
                }

                return s;
            }

The system doesn't use the jeasy UI tooltips. Any idea how i can fix this?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: January 03, 2014, 08:19:04 AM »

Please parse the tooltip components when loaded data successfully.
Code:
$('#tt').tree({
  onLoadSuccess:function(){
    $.parser.parse($(this));
  }
});
Logged
iceh
Jr. Member
**
Posts: 61


View Profile
« Reply #2 on: January 03, 2014, 01:47:39 PM »

Thx!

I also had a Typo in my formater - now it works fine!
Logged
iceh
Jr. Member
**
Posts: 61


View Profile
« Reply #3 on: January 06, 2014, 07:44:16 AM »

Now I have an other issue Wink

It works fine, but DnD in the tree won't
kill the tooltip.

So in some instances the tooltip doesn't vanish
when a DnD event occures during the tooltip
is active.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #4 on: January 07, 2014, 12:44:10 AM »

The simplest way to solve this issue is to destroy all the tooltip when start dragging a node and then restore all the tooltip when stop dragging.
Code:
	<ul class="easyui-tree" data-options="
data:data,animate:true,dnd:true,
formatter:function(node){
return '<span title=\'' + node.text + '\' class=\'easyui-tooltip\'>' + node.text + '</span>';
},
onStartDrag:function(node){
$(this).find('.tooltip-f').tooltip('destroy');
},
onStopDrag:function(node){
$.parser.parse($(this));
},
onLoadSuccess:function(){
$.parser.parse($(this));
}"></ul>

Logged
iceh
Jr. Member
**
Posts: 61


View Profile
« Reply #5 on: January 07, 2014, 06:45:27 AM »

Thank you!

That looks soooo cool  Grin Grin Grin Grin
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!