user4818847
user4818847

Reputation:

Fancytree update tree with new data

I've been trying to use reload() to update the tree to new data but the whole tree reloads which is not wanted. Just want that the nodes get updated with the new data which will contain child data for the nodes. I do not want to reload the whole tree insted i want to keep the current nodes that I've expanded.

New to fancytree, any help is appreciated.

Upvotes: 4

Views: 4481

Answers (2)

joshua
joshua

Reputation: 4198

This worked for me:

 var rootNode = $(el).fancytree("getRootNode");
 rootNode.removeChildren();
 rootNode.addChildren(newTreeData);

Upvotes: 3

sfinks_29
sfinks_29

Reputation: 918

You can use node.load(); This is applied to a single node, so you'll need to loop through all nodes you want re-loaded.

The load function is explained here: http://www.wwwendt.de/tech/fancytree/doc/jsdoc/FancytreeNode.html#load

Upvotes: 0

Related Questions