Skip to content

Copy one tree to another tree #2683

Answered by Raketten1963
Raketten1963 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi all,

After a sleepless night, the obvious solution revealed itself in all it's simplicity.

The source tree already exist, so I can just grab the data and provide that to the destination tree upon creation.

      let data = [];
       let topnode = theTree.get_node(theNodeId);

       data.push({ "id" : topnode.id, "type" : topnode.type, "parent" : topnode.parent, "text" : topnode.text, state: {opened: true, }})
       for (let i=0; i < topnode.children_d.length; i++){
           let childnode = theTree.get_node(topnode.children_d[i]);
           data.push({ "id" : childnode.id, "type" : childnode.type, "parent" : childnode.parent, "text" : childnode.text})
       }

Just or even more e…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Raketten1963
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant