Trying to cancel SelectionDeleting Event, but event parameter does not have cancel property.
Can you please give me an example which can explain how to cancel “SelectionDeleting” Event.
I Tried with the following code, but not working.
TreeLayoutDiagram.prototype.onDiagramSelectionDeleting = function (event) {
var e = event.diagram.lastInput.event;
That’s correct – there is no “cancel” property on DiagramEvent. There used to be, but we removed it in version 2.0 because it was problematic. The change log describes how to implement the equivalent behavior.
Yes, that was from four years ago. It’s in GoJS Change Log for 2.0:
DiagramEvent.cancel
The only use for this property was with the "SelectionDeleting"DiagramEvent in order to prevent the user from deleting the selection. Where one might have written this Diagram listener:
Overriding the method supports the updating/enablement of commands that call CommandHandler.deleteSelection. Furthermore not having a “cancel” property on the DiagramEvent avoids any potential problems that might occur if there are multiple listeners for the "SelectionDeleting" event. The "SelectionDeleting"DiagramEvent remains useful, but not for controlling whether or not the deletion should happen.