In Angular with TypeScript, what is the best way to select a node from a diagram based on its key?
Currently, I am required to left-click a newly created node in order to select it, but I would like for it to be automatically selected upon creation.
I have been attempting to use a function to select a node with a specific key ("1"), however, my current approach does not seem to be working as expected. Here is the code snippet of what I have tried:
selectItem(item: any) {
this.selectedItem = item;
this.myDiagram.select(this.myDiagram.findNodeForKey(item.key));
if (this.selectedItem['toPort']) {
this.selectedItemtype = 'Link';
this.myDiagram.select(this.myDiagram.findLinkForData(item));
} else {
this.selectedItemtype = 'Node';
this.myDiagram.select(this.myDiagram.findNodeForKey(item.key));
}
// this.rerender();
}
After dragging an item from a tree into the diagram window and opening the property window to edit its properties, I want to be able to edit the properties immediately upon drop. However, I have noticed that if I make changes to the item and click on it again, the edits are lost. How can I ensure that the edited item stays consistent even after clicking on it again?