Create a fancytree from a subset of nodes from another tree

129 views Asked by At

Is it possible to create a fancytree from a subset of nodes that exist in another fancytree?

In essence what I want to accomplish is that a user clicks on a node in a tree, use the key of the node to get its structure (with all of its children) and then pass that into the source of a new tree.

So something like this:

var tree = $.ui.fancytree.getTree("#exampleTree");
var node = tree.getNodeByKey(key);

$("#newTree").fancytree({
    selectMode: 1,
    source: {node}
});

Any help would be greatly appreciated.

1

There are 1 answers

0
mar10 On

This should be doable using a combination of subNodes = node.toDict(true) and tree.reload(subNodes).

See also the API docs.