Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Transactions : diagram vs model

$
0
0

@rdheepan wrote:

Hi, we have four simple transactions in our application.
1. updating node data
2. deleting node
3. changing links (from one parent to another )
4. 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);

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles