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

Problems with dragging nodes in diagram scripts

Thread ID:





133034 Oct 5,2017 06:49 AM UTC Oct 10,2017 03:59 AM UTC JavaScript 3
Tags: ejDiagram
Andrey Kucher
Asked On October 5, 2017 06:49 AM UTC

I need to implement simple dragndrop functionality in your diagram control. Just need to highlight target node. I also need to replace dragged and target nodes, but it doen't works as well. 
I have implemented simple scipts, but it doesn't work by some cause. Looks like diagram drag event specifically handled nodes and can't change it as required.
Could you please show me how could I accomplish my task?
You could found my script in attachment and get aspx with diagram from this topic (https://www.syncfusion.com/forums/133019/asp-diagram-drag-n-drop-nodes)

Attachment: DragNodes_aee61a22.7z

Shyam G [Syncfusion]
Replied On October 6, 2017 06:20 AM UTC

Hi Andrey, 
Please enable the AllowDrop constraints for nodes/connectors which shows the highlighter, when we drag the node/connector and mouse hover on the another node/connector. Also use drop event to achieve your requirement and this event triggers when we drag the node/connector and drop it onto another node/connector. Please refer to the code example and  modified sample below. 
Code example: 
//define drop event 
eliminationChart.OnClientDrop = "drop"; 
  function drop(args) { 
            var diagram = $("#EliminationChart").ejDiagram("instance"); 
            if (!args.source.cssClass) { 
                if (diagram.getObjectType(args.target) == "node") { 
                    if (args.element) { 
                        var connector = diagram.findNode(args.element.inEdges[0]); 
                    if (connector) { 
                        diagram.updateConnector(connector.name, { sourceNode: args.target.name, targetNode: args.element.name }); 
                    else { 
                        diagram.add({ name: "connector" + ej.datavisualization.Diagram.Util.randomId(), segments: [{ type: "orthogonal" }], sourceNode: args.target.name, targetNode: args.element.name }); 
            //update the layout 
Please refer to the KB link below which shows how to perform drag and drop operation in layout. 
Shyam G 

Andrey Kucher
Replied On October 9, 2017 09:31 AM UTC

Thanks, this works!

Shyam G [Syncfusion]
Replied On October 10, 2017 03:59 AM UTC

Hi Andrey, 
Please let us know if you need further assistance on this. 
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