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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Saving diagrams in MongoDB

Thread ID:

Created:

Updated:

Platform:

Replies:

130247 May 2,2017 10:33 AM UTC May 29,2017 12:47 PM UTC Angular 7
loading
Tags: ejDiagram
yasmine
Asked On May 2, 2017 10:33 AM UTC

Hi,

I'm building a M.E.A.N app and i need to save my hierarchicallayouts and swimlanes in MongoDB and i can't figure out how to do that.,
So If it's possible, how can i do that? 

Thank You

Shyam G [Syncfusion]
Replied On May 3, 2017 12:50 PM UTC

Hi Yasmine, 
 
Please use diagram’s save method which helps to serialize the Diagram as JSON. This JSON data can be converted to string and stored for future use. Please refer to the code example and help documentation. 
 
Code example: 
var diagram = $("#ejControl_0").ejDiagram("instance"); 
        //get the serialized JSON 
        var savedDiagram = diagram.save(); 
        //stringify the serialized JSON 
        var string = JSON.stringify(savedDiagram); 
 
 
Regards, 
Shyam G 


yasmine
Replied On May 6, 2017 05:00 PM UTC

Hi,     I m new to all this so i find it hard to get it to work, so if i may get a demo or something more clear on how implement that in my code correctly and to serialize the Diagram.I would really appreciate your help..     Thank you, 

Shyam G [Syncfusion]
Replied On May 10, 2017 01:20 PM UTC

Hi Yasmine, 
 
We have created an Angular 2 layout sample in which we have shown how to get the JSON string from the save method. Now you can connect Angular 2 with MongoDB and save that string into the database. 
 
 
Please look into the below link to create a MEAN app. 
 
 
Regards, 
Shyam G 


yasmine
Replied On May 10, 2017 05:23 PM UTC

Thank You So Much!

Shyam G [Syncfusion]
Replied On May 11, 2017 04:35 AM UTC

Hi Yasmine, 
please let us know if you need further assistance on this. 
Regards, 
Shyam G 


AliCharper
Replied On May 27, 2017 03:06 AM UTC

Hi Yasmine, 
please let us know if you need further assistance on this. 
Regards, 
Shyam G 


May I know is there any possibility to have events on Digram?. I need to fire an event once client create a new Node for example. Then I can send the change to my backend service.


Regards
Ali

Shyam G [Syncfusion]
Replied On May 29, 2017 12:47 PM UTC

Hi Ali, 
 
Please use nodeCollectionChange event to achieve your requirement. Please refer to the code example below. 
 
Code example: 
<ej-diagram id="diagramCore" (nodeCollectionChange)="nodecollectionchange($event)"> 
            </ej-diagram> 
 
nodecollectionchange(e) { 
        alert("nodecollectionchange event triggered"); 
    } 
 
Regards, 
Shyam G 


CONFIRMATION

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.

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

;