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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to get the nodes list and connectors after changes made in front end

Thread ID:

Created:

Updated:

Platform:

Replies:

146058 Jul 18,2019 06:59 AM UTC Jul 24,2019 06:30 AM UTC ASP.NET Core - EJ 2 3
loading
Tags: Diagram
Aung Myo
Asked On July 18, 2019 06:59 AM UTC

I am trying to use the flow chart with .net core. I want to get the nodes and connectors list to my controller after the changes made in the front end. How to do that? Any sample project can I get? Thanks

Shyam G [Syncfusion]
Replied On July 20, 2019 01:58 AM UTC

Hi Aung, 
We have created a sample in which when we click a GetDiagramController button we save a diagram using diagram saveDiagram method and send that Json to server side using Ajax. In server side, you can deserialize an JSON string and process nodes and connectors. Please refer to a code example and sample below. 
Code example: 
     function getDiagramController() {  
            var diagram = document.getElementById("container").ej2_instances[0]; 
            var JsonData = diagram.saveDiagram(); 
            //pass an saved JSON to an server side 
            $.ajax({ 
                url: "/Diagram/DiagramJson", 
                type: "Post", 
                dataType: "json", 
                data: { "JsonData": JsonData }, 
                success: function (JsonData) { 
                    alert("Success"); 
                    return true; 
                }, 
            }) 
        } 
 
    [HttpPost] 
        public void DiagramJson(string JsonData) 
        { 
            Dictionary<string,object> DiagramData = JsonConvert.DeserializeObject<Dictionary<string, object>>(JsonData); 
            //To get nodes collection 
            List<DiagramNode> Nodes = JsonConvert.DeserializeObject <List<DiagramNode>> (DiagramData["nodes"].ToString()); 
            //Iterate an nodes 
            foreach(var node in Nodes) 
            { 
                // process each node 
                node.Width = 100; 
            } 
            //To get connectors collection 
            List<DiagramConnector> Connectors = JsonConvert.DeserializeObject<List<DiagramConnector>>(DiagramData["connectors"].ToString()); 
            //Iterate an connectors 
            foreach (var connector in Connectors) 
            { 
                // process each connector 
                connector.CornerRadius = 0.5; 
            } 
        }  
 
 
Regards, 
Shyam G 


Aung Myo
Replied On July 24, 2019 02:49 AM UTC

Hi Shyam G ,

Thanks for your support. It works.

Ramya Thirugnanam [Syncfusion]
Replied On July 24, 2019 06:30 AM UTC

Hi Aung,  
 
Thanks for your update. 
 
Regards,  
Ramya T  


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.

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