You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to read which nodes are expanded when I click a button in the page that is rendering my orgchart.
To do so I pass a reference to the same data object I pass to d3 and check if the _expanded flag is set, this gives me a value of true if the node is expanded and a value of undefined otherwise.
My issue is that for the nodes that are already visibile when the tree first renders the value is always undefined.
If I hide all the nodes exepct the root the values are then set to false for all the nodes.
After that if I expand again the tree the value for all nodes except the root are set to true when I would exepect them to, but the value for the root alwys stays on false.
I also tried checking the expanded, _children, children, _centered and centered flags for all nodes and they always are undefined. In fact, the only property that is set when interacting with the tree is _expanded.
Is there a way that I can check with nodes are open on the orgchart at any given time?
The text was updated successfully, but these errors were encountered:
If the node parent has .children property, then the current node is expanded, otherwise if the node parent has _children property then current node is collapsed
You're right that I can get that info from the handlers implemented by the library like onNodeClick and onExpandOrCollapse.
Since I was seeing the _expanded property being modified in the original data object I had hoped that I could have access to the same data from outside the methods of OrgChart.
This seems to be an unintended side effect and the data object itself is (correctly) cloned for internal use.
I need to read which nodes are expanded when I click a button in the page that is rendering my orgchart.
To do so I pass a reference to the same data object I pass to d3 and check if the
_expanded
flag is set, this gives me a value oftrue
if the node is expanded and a value ofundefined
otherwise.My issue is that for the nodes that are already visibile when the tree first renders the value is always
undefined
.If I hide all the nodes exepct the root the values are then set to
false
for all the nodes.After that if I expand again the tree the value for all nodes except the root are set to
true
when I would exepect them to, but the value for the root alwys stays onfalse
.I also tried checking the
expanded
,_children
,children
,_centered
andcentered
flags for all nodes and they always are undefined. In fact, the only property that is set when interacting with the tree is_expanded
.Is there a way that I can check with nodes are open on the orgchart at any given time?
The text was updated successfully, but these errors were encountered: