How to Update Node and Treeview Content in React Diagram?
The TreeView component is a graphical control that displays a hierarchical structure of nodes. Syncfusion® provides support for TreeView in React Diagram .
To update Nodes and TreeView content at runtime, we can use the dialog component to update both nodes and TreeView nodes.
Define the Dialog component in the HTML.
<DialogComponent
width="300px"
id="dialog"
ref={(dialog) => (Dialog = dialog)}
visible={false}
showCloseIcon={true}>
</DialogComponent>
How to update the content of a node and TreeView.
- The dialog box will get triggered upon double-clicking the diagram nodes.
- Edit the input area of the dialog box, and by using the Update button, we can update both the nodes and TreeView content.
function send() {
let getContent = document.getElementById('inVal');
let content = getContent.value;
diagramInstance.selectedItems.nodes[0].annotations[0].content = content;
let data = items;
let treeview = treeObj;
let elementNodeId = diagramInstance.selectedItems.nodes[0].id;
let tempData = workingData.filter((a) => a.Id === elementNodeId);
treeview.updateNode(tempData[0].Id, content);
diagramInstance.dataBind();
Dialog.visible = false;
}
Sample: Click Here
Conclusion
I hope you enjoyed about how to update node and Treeview content in React Diagram.
You can refer to our React Diagram feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our React Diagram example to understand how to create 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 other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!