I want to create a tree with treant.js the structure form is like this:
var tree_structure=[ {container: '#OrganiseChart8', levelSeparation: 70, siblingSeparation: 60, nodeAlign: 'BOTTOM', connectors: {
type: "step",
style: {
"stroke-width": 2,
"stroke": "#ccc",
"stroke-dasharray": "--",
}
},
{innerHTML: '#first-post'},
{parent: {innerHTML: '#first-post'}, innerHTML: '#1-reply'},
{parent: {innerHTML: '#first-post'}, innerHTML: '#2-reply'}
}];
new Treant(tree_structure);
displaying this code gives me a single node, which is the result of ({innerHTML: '#first-post'}) in case when I make each code of node in a variable , everything is going well, like this:
var first= {innerHTML: '#first-post'},
child1 ={ parent: first, innerHTML: '#1-reply'},
child2 ={ parent: first, innerHTML: '#2-reply'};
var tree_structure=[first,child1,child2];
new Treant(tree_structure);
The result gives me a display of three nodes. remarque: in my case, the tree dynamic (nodes processed via a database) and recursive, mince , I have much of node , the parent of child1_1 is child1
{parent: {parent: {innerHTML: '#first-post'}, innerHTML: '#1-reply'}, innerHTML: '#1-reply-1'}
Thanks in advance.