Closed MateoCaicedoW closed 1 year ago
Yes. we don't support two parents. For the workaround, it's possible to use connections, to connect any node to any node
Or you could set a "fake-root" as the supreme leader and then just set its properties so it doesnt appears to be on screen:
.childrenMargin((d) => { return d.depth === 0 ? -100 : 120; }) .linkUpdate(function (d) { d3.select(this) { if (d.depth === 1) { d3.select(this).attr('display', 'none'); } } }) .nodeUpdate(function (d) { if (d.depth === 0) { d3.select(this).attr('display', 'none'); d.height = 0; d.width = 0; } })
check #59, #138
great! but, if I want expand the two first levels, how can I get that? @devjaof
is there any way to expand the 3 first levels? @bumbeishvili
great! but, if I want expand the two first levels, how can I get that? @devjaof
I dont know if this is the best solution for this problem, but to do this i created a method that returns the children of two first levels and then i set each one of the children as expanded using chat.setExpanded(node) where node is the children i want to keep expanded;
@bumbeishvili can you confirm if there is a cleanest way to keep those childrens expanded?
I don't think that currently there is another way.
In the future, you will be able to set expandLevel
initially, it does not work currently
I don't think that currently there is another way.
In the future, you will be able to set
expandLevel
initially, it does not work currently
Great!
I made this to solve this problem
let secondLevel = rawData.filter((d) => d.parentId == 1); rawData.forEach((d) =>{ if (d.parentId !== 1 && secondLevel.some((e) => e.id == d.parentId)) { d._expanded = true; } });
My first level is a node with 1 as ID.
I am updating the expand-level functionality.
From now on you. can configure the depth at which the org chart will open
chart.initialExpandLevel(0) // Only root node will open
chart.initialExpandLevel(1) // Default behavior, root and it's children will be expanded
chart.initialExpandLevel(2) // All nodes with depth 2 will be expanded
Describe the bug when there are two or more people as a leader the library doesn't work