Articles in this section

How to Determine Node Selection Programmatically in React Diagram?

This article explains how to determine node selection programmatically in React Diagram. In our Syncfusion® React Diagram, nodes can be selected either through user interaction or programmatically. To select nodes via user interaction, the user can simply click on the nodes. For programmatic selection, you can use the select method.

let node = [
 {
   // Position of the node
   offsetX: 250,
   offsetY: 250,
   // Size of the node
   width: 100,
   height: 100,
 },
]; 
<DiagramComponent
       id="container"
       ref={(diagram) => (diagramInstance = diagram)}
       width={'100%'}
       height={'600px'}
       nodes={node}
     /> 
     
function rendereComplete() {
   diagramInstance.fitToPage();
   diagramInstance.select([diagramInstance.nodes[0]]);
}

Refer to the working sample for additional details and implementation: Click here

Conclusion

We hope you enjoyed learning about how to determine the node selection either programmatically or through user interaction in React Diagram.

You can refer to our React Diagram feature tour page to know 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!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied