Articles in this section

How to prevent deletion of node or connector in Vue Diagram using delete constraints?

This article explains how to prevent the deletion of a node or connector in Vue Diagram using delete constraints. In the Syncfusion® Vue Diagram, by using the NodeConstraints and ConnectorConstraints, we can enable or disable certain features of nodes or connectors.

To prevent the deletion of a node or connector in the diagram using delete constraints, set the constraints as follows for nodes and connectors.

<ejs-diagram style='display:block'  ref="diagramObj" id="diagram" :width='width' :height='height' :nodes='nodes' :connectors= connectors ></ejs-diagram>

// Set constraints to disable deletion for Node
constraints: NodeConstraints.Default & ~NodeConstraints.Delete

var nodes =
[
  {
      id: "heptagon",
      offsetX: 100,
      offsetY: 160,
      width: 80,
      height: 80,
      constraints: NodeConstraints.Default & ~NodeConstraints.Delete
  },
];

// Set constraints to disable deletion for Connector
constraints: ConnectorConstraints.Default & ~ConnectorConstraints.Delete
var connectors =
[
  {
      id: "select",
      type: 'Orthogonal',
      constraints: ConnectorConstraints.Default & ~ConnectorConstraints.Delete
      sourcePoint: {
          x: 200,
          y: 150
      },
      targetPoint: {
          x: 320,
          y: 250
      }
  },
];

You can find a working example of this implementation in the provided sample on StackBlitz.

Sample

Conclusion

We hope you enjoyed learning about how to prevent the deletion of a node or connector in Vue Diagram using delete constraints.

You can refer to our Vue Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications.
You can also explore our Vue Diagram example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, BoldDesk Support, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied