We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Can't stringify diagram event

Thread ID:





149076 Nov 13,2019 04:44 PM UTC Nov 15,2019 12:37 AM UTC React - EJ 2 3
Tags: Diagram
raphael chancey
Asked On November 13, 2019 04:44 PM UTC

I am trying to print out the event from 'click' on the diagram, and getting exception.

I simply have an empty diagram with nothing on it..

<DiagramComponent id="diagram"
ref={diagram => (diagramInstance = diagram)}
width={"100%"} height={"1000px"}
type: "ComplexHierarchicalTree",
verticalSpacing: 30,
horizontalSpacing: 40,
enableAnimation: true
click={(e) => { self.diagramSelected(e) }}
<Inject services={[ComplexHierarchicalTree, LayoutAnimation]} />

I get this error:
TypeError: JSON.stringify cannot serialize cyclic structures

simply trying to do this:
click={(e) => { self.diagramSelected(e) }}

diagramSelected(e) {
console.log(`selection changed `, JSON.stringify(e));

Shyam G [Syncfusion]
Replied On November 14, 2019 10:53 AM UTC

Hi Raphael, 
The cyclic error forms when an object holds a reference to another object. So we have a cyclic structure formed in our nodes. Please refer to the below node to know more about cyclic structure. If you need to serialize a diagram object, please use a saveDiagram method which will return the serialized json model object. Please refer to a help documentation below. 

Shyam G 

raphael chancey
Replied On November 14, 2019 02:47 PM UTC

ok.. makes sense.. thank you

Shyam G [Syncfusion]
Replied On November 15, 2019 12:37 AM UTC

Hi Raphael, 
Thanks for your update. 
Shyam G 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon