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
close icon

Disabling node and connector moving

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


3 Replies

SG Shyam G Syncfusion Team 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 



KO Kevin Orcutt September 6, 2019 12:47 PM UTC

Hey Shyam,
Perfect!  Worked like a charm!  

Many Thanks!!!

Keviin



SG Shyam G Syncfusion Team September 9, 2019 04:19 AM UTC

Hi Kevin, 

Thanks for your update. 

Regards, 
Shyam G 


Loader.
Live Chat Icon For mobile
Up arrow icon