Hi Ahman,
If you need to disable delete action for an entire diagram while pressing delete key on keyboard, you can use command Manger to achieve your requirement. we have created a playground link in which we have disabled the delete action using command manager.
Code example:
$("#diagram").ejDiagram({
commandManager:{
commands: {
"delete": {
canExecute: function (args) {
if (args.model.selectedItems.children.length > 0) {
return true;
}
},
execute: function (args) {
// do your custom actions
},
gesture: {
key: ej.datavisualization.Diagram.Keys.Delete,
}
}
}
},
});
});
Also, if you need to disable an delete action for an particular object, you can remove Delete NodeConstraints from Default NodeConstraints. Please refer to the code example below.
Code example:
var nodes =
[
{ name: "NewIdea", constraints: ej.datavisualization.Diagram.NodeConstraints.Default & ~ej.datavisualization.Diagram.NodeConstraints.Delete, width: 150, height: 60, offsetX: 300, offsetY: 60, },
];
$("#diagram").ejDiagram({
nodes:nodes
})
Regards,
Shyam G