Preventing the deletion of the selection

Hi Walter,
I am trying to remove node based on some condition and added diagram add listener for SelectionDeleting event. But it always delete whether I return true or false.
How I can I prevent node deletion based on some condition?

Thanks .

The DiagramEvent listeners all do not care if they return anything – they are declared returning void. In the go.d.ts file, the declaration is:
addDiagramListener(name: DiagramEventName, listener: ((e: DiagramEvent) => void)): void;

Override https://gojs.net/latest/api/symbols/CommandHandler.html#canDeleteSelection.

See also the 2.0 release notes.

That worked. Thanks.

However I noticed that modification of node text data (bind with name property) does not show changed value during modification. It shows only initial bound name value.
Am i missing something?

What do you mean? Please provide details.

NodeData linked with diagram shows name value bound with text-block’s text property. Which is fine. But when I modify name value , it does not display changed value in text-block. It shows changed value only after I re-render diagram. Is there any way I can fire change event after changing value to re-render diagram by itself ?

How did you modify the name property on the data?
https://gojs.net/latest/intro/dataBinding.html#ChangingDataValues