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
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Disabling node and connector moving

Thread ID:

Created:

Updated:

Platform:

Replies:

147307 Sep 5,2019 02:20 PM UTC Sep 9,2019 04:19 AM UTC jQuery 3
loading
Tags: ejDiagram
Kevin Orcutt
Asked On September 5, 2019 02:20 PM UTC

We have a diagram that the nodes and connectors are loaded on page load.  We would like to be able to disable moving of the nodes and connectors.  We would still like to be able to select nodes, but just not allow the moving of them.  I figure that this would probably be set in the getNodeDefaults javascript function, but are not sure.  Also, I've seen in the WinForms area that there is something along the lines of editstyle.allowmove, but I haven't figured out a way to access this and or set it...

Any clues or help would be greatly appreciated!

Thanks in advance,

Kevin Orcutt            
Senior Applications Developer
Phone: (513) 985-7090
Email: korcutt@belcan.com
www.belcan.com


Shyam G [Syncfusion]
Replied On September 6, 2019 05:59 AM UTC

Hi Kevin, 
 
Please remove Drag NodeConstraints from Default and remove DragSourceEnd and DragTargetEnd ConnectorConstraints from Default to disable dragging of nodes and connectors. Please refer to a code example and sample below. 
 
In the below code example, we use the functions getNodeDefaults and getConnectorDefaults to disable node and connector constraints respectively. These functions are called for each initialization of nodes and connectors. 
 
Code example: 
 
//Initializes diagram control 
    var diagram = new ej.diagrams.Diagram({ 
        width: '100%', height: '700px',   
 
        //Sets the default values of a node 
        getNodeDefaults: function (obj) {   
           // Disable dragging for node 
            obj.constraints = ej.diagrams.NodeConstraints.Default &~ej.diagrams.NodeConstraints.Drag;   
        }, 
        //Sets the default values of a Connector. 
        getConnectorDefaults: function (obj) { 
          // Disable dragging for connector 
           obj.constraints = ej.diagrams.ConnectorConstraints.Default &~(ej.diagrams.ConnectorConstraints.DragSourceEnd | ej.diagrams.ConnectorConstraints.DragTargetEnd); 
        }, 
  
    }); 
    diagram.appendTo('#diagram'); 
 
 
Regards, 
Shyam G 


Kevin Orcutt
Replied On September 6, 2019 12:47 PM UTC

Hey Shyam,
Perfect!  Worked like a charm!  

Many Thanks!!!

Keviin


Shyam G [Syncfusion]
Replied On September 9, 2019 04:19 AM UTC

Hi Kevin, 

Thanks for your update. 

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.

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