selecting a node and deleting it is not deleting the node. But if I click on node twice and then press keyboard delete, then node is getting deleted. Are we missing something ?
In some cases, even after multiple clicks on node and then press keyboard delete, node is not getting deleted.
The default value for Diagram.allowDelete is true, so you don’t need to set it to allow users to delete a Part.
I cannot explain why it sometimes works and sometimes not. Do you set Diagram.isReadOnly or Part.deletable at all? How do you modify the model, if at all? Have you overridden the CommandHandler.deleteSelection command method? Have you overridden any other methods?
Thanks @walter . Upon configuring properly, I am able to delete using keyboard delete.
But now we are seeing issue consistently that. Only upon clicking on node twice only we are able to delete… If we click on node only once and press delete, it’s not deleting…
We have custom SelectionChanged event handler. But we didn’t override any logic related to delete…
We are not changing selected node as part of ChangedSelection listener @walter
On clicking on orphan node the selected adornment is visible. But delete is not working. Once we click two times on a node and then keyboard delete is working.
OK, you’ll need to investigate why it’s not working in your app.
Pressing the Delete key calls the CommandHandler.deleteSelection method, which performs a transaction in which it calls Diagram.removeParts. You could try setting a breakpoint in those two methods to see if they are called when the user tries to delete the first time.
Depending on what you discover, maybe we can investigate further.
OK, so now you know that the first Delete key press event is not getting to the Diagram. Normally that is because the Diagram’s Div element does not have keyboard focus.
We know that you have a problem with your Diagram losing focus from your other forum topic.