Hi, we have four simple transactions in our application.
- updating node data
- deleting node
- changing links (from one parent to another )
- removing links
As per the documentation, all of the above code should be inside a transaction.
But should we use the transaction on diagram or model?
In one of your comments , i can see the below quote
“why don’t you remove the Links from the Diagram instead of removing the link data from the Model”
So, where do i find the information on ‘differences between diagram transactions and model transactions’ and ‘when to use what’?
below are the example code that we use,
Update Node
let node = diagram.findNodeForKey(key);
diagram.startTransaction(txnUpdateNode);
node.data.name = data.name;
node.data.title = data.title;
node.data.description = data.description;
node.data.type = data.type;
node.data.status = data.status;
node.updateTargetBindings();
diagram.commitTransaction(txnUpdateNode);
Delete Node
diagram.startTransaction(txnDeleteNode);
diagram.commandHandler.deleteSelection();
diagram.commitTransaction(txnDeleteNode);