0

I have been working on collapsible tree in which a large set of data overlapping occurs and the whole tree looks clumsy. What I am trying to do is to open a data-table and expand only selected nodes from the data-table something like this, on selecting MN type node, a data-table opens here and on selecting any of up to 5 nodes using checkbox,all the 5 nodes shall be expanded to that parent MN node like this but it does not expand here.

This is what I have tried so far

var selected;  //select node to which data shall be expanded
var selectedMnDataArray =[]; //collecting data from data-table
selectedMnDataArray.parent = selected; 

if(!selected.children){
                selected.children = [];
                selected.treeData5.children = [];
              }
              selected.children.push(selectedMnDataArray);
              selected.treeData5.children.push(selectedMnDataArray.data);

              update(selected);

But this only expands a link as you can see in the picture.

Another thing I tried is from the post d3.js how to dynamically add nodes to a tree

But this also doesn't work in my case.

please anyone help me out here.

N.B.
  • 13
  • 3
  • `var selectedMnDataArray =[];` this will define this variable as an Array. But later you typed `selectedMnDataArray.parent = selected` which overwrites the first statement turning the array into a JSON object. – Ahmad Nov 19 '18 at 04:48
  • yeah that is the point as I am collecting data from data-table as an array of objects, which shall be expanded next and selectedMnDataArray.parent = selected is marking that nodes inside array shall be children to which parent. – N.B. Nov 19 '18 at 05:06

0 Answers0