treant-js icon indicating copy to clipboard operation
treant-js copied to clipboard

How to make the root node collapsed?

Open spearsear opened this issue 5 years ago • 0 comments

Hi,

I want to make the root node collapsed. Here is what my configuration:

{"chart":{"container":"#ngpTree","animateOnInit":true,"node":{"collapsable":true},"animation":{"nodeAnimation":"easeOutBounce","nodeSpeed":700,"connectorsAnimation":"bounce","connectorsSpeed":700}},"nodeStructure":{"collapsed":true,"innerHTML":"\n

<td class="ngp-align-top">=><td class="ngp-align-bottom">=><td class="ngp-align-bottom">7
12
34
\n ","text":{"name":7},"children":[{"collapsed":true,"innerHTML":"\n<td class="ngp-align-top">=><td class="ngp-align-bottom">=><td class="ngp-align-bottom">3
1
3
\n ","text":{"name":3},"children":[{"collapsed":true,"innerHTML":"\n<td class="ngp-align-top">=><td class="ngp-align-bottom">=><td class="ngp-align-bottom">0
1
\n ","text":{"name":0},"children":[]}]},{"collapsed":true,"innerHTML":"\n<td class="ngp-align-top">=><td class="ngp-align-bottom">=><td class="ngp-align-bottom">3
12
\n ","text":{"name":3},"children":[{"collapsed":true,"innerHTML":"\n<td class="ngp-align-top">=><td class="ngp-align-bottom">=><td class="ngp-align-bottom">1
1
\n ","text":{"name":1},"children":[]}]}]}}

You see in nodeStructure of root node, I set collapsed to true as what I did for each child node:

"nodeStructure":{"collapsed":true,"innerHTML":....

However the root node still is not collapsed, the children nodes are collapsed as I wanted.

Is this the way I make the root node collapsed? If not, how?

Thanks,

Stephen

spearsear avatar May 30 '19 02:05 spearsear