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

Update data property in InitialLayoutCompleted

$
0
0

@Dominic.Lerbs wrote:

Hi,

I am updating a data property in the InitialLayoutCompleted DiagramEvent:

diagram.startTransaction("Update nodes' valid property");
diagram.model.setDataProperty(node.data, "_valid", isValid);
diagram.commitTransaction("Update nodes' valid property");

This works when I initially create the diagram and set the model. But when I clear the diagram and set a different model, the binding for the “_valid” property ( borderShape.bind(new go.Binding("visible", "_valid");) does not get evaluated.
However, wrapping the data property update in a setTimeout call works:

setTimeout(() => {
 diagram.startTransaction("Update nodes' valid property");
    diagram.model.setDataProperty(node.data, "_valid", isValid);
    diagram.commitTransaction("Update nodes' valid property");
}, 100);

Is it a bad idea to update a data property in the InitialLayoutCompleted event listener? Or is there most likely some other issue in my code?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles