How to Render Complex Tree With Collapsed Child Node in React Diagram?
This article explains how to render a complex tree with collapsed child nodes in React Diagram. In our Syncfusion® React Diagram, layout nodes can be both expanded and collapsed. By default, child nodes are expanded. If you want to display a complex hierarchical tree with child nodes collapsed, set the parent node’s isExpanded
property to false
.
index.js
getNodeDefaults={(node) => {
// Setting isExpanded to false
if (node.data.Name === 'node12' || node.data.Name === 'node27') {
node.isExpanded = false;
}
return node;
}
Refer to the working sample for additional details and implementation:
Sample: Click here
Conclusion
We hope you enjoyed learning about how to render a complex tree with collapsed child nodes in React Diagram.
You can refer to our React Diagram Featuretour feature tour page to learn about its other groundbreaking feature representations and documentations. You can also explore our React Diagram Example to understand how to present and manipulate data.
For current customers, you can check out our components from the License and Downloads page.
If you are new to Syncfusion®, you can try our 30-day free trial to check out our React Spreadsheet and other components.
If you have any queries or require clarifications, please let us know in the comments below. You can also contact us through our support forums, BoldDesk Support, or feedback portal. We are always happy to assist you!