EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: devnull on May 21, 2015, 07:22:07 PM



Title: Calling the tree formatter after calling update() [Solved]
Post by: devnull on May 21, 2015, 07:22:07 PM
Hi;

How can I have the tree reformat one or all of it's nodes after applying the update() method ?


Title: Re: Calling the tree formatter after calling update()
Post by: stworthy on May 21, 2015, 07:42:20 PM
You have to call 'update' or 'reload' methods to update the node's text.


Title: Re: Calling the tree formatter after calling update()
Post by: devnull on May 21, 2015, 07:44:07 PM
Thanks, yes I know that:

Code:
tr.tree('update',{target:node.target,text:'xxx'});

But how can I call the formatter() method which is defined for the tree so that it applies the formatting to the changes.


Title: Re: Calling the tree formatter after calling update()
Post by: stworthy on May 21, 2015, 07:49:21 PM
The 'formatter' function must be defined.
Code:
$('#tt').tree({
  formatter:function(node){
    return node.text;
  }
});

Calling 'update' method will auto apply the formatted text on the special node.


Title: Re: Calling the tree formatter after calling update()
Post by: devnull on May 21, 2015, 07:55:33 PM
Thanks, yes I already had the formatter, but I just discovered that there a typo error in the formatter method I created.

Thanks for the fast response.