Quantcast
Channel: Northwoods Software - Latest topics
Viewing all articles
Browse latest Browse all 7403

How to cancel addnode from palette?

$
0
0

@haohan007008 wrote:

From the palette before dragging a node to the Diagram, how to judge the existing node in the Diagram, if present, is not allowed to add it?
thanks.

i use follow code

myDiagram.addModelChangedListener(function(evt) {
if (!evt.isTransactionFinished) return;
var txn = evt.object; // a Transaction
if (txn === null) return;
txn.changes.each(function(e) {
if (e.change === go.ChangedEvent.Insert && e.modelChange === "nodeDataArray") {
console.log(" e.modelChange: " + e.modelChange);
if(e.newValue){
//alert(e.newValue.category);
return ;
}
} else if (e.change === go.ChangedEvent.Remove && e.modelChange === "nodeDataArray") {
console.log(evt.propertyName + " removed link: " + e.oldValue);
}
});
});

but doen't work.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7403