I want my diagram to automatically recognize if it contains two or more nodes sharing the same value on a common property. I have an external model with global node IDs (“gid”), and can have multiple instances of any given node from the model represented as nodes within myDiagram (they are using the standard “key” as their identifier).
My plan was to use data bindings & conversion functions to recognize that myDiagram.findNodesByExample({gid: “example”}) returns an iterator of count > 1. I ran into a behavior I didn’t expect, however, when I realized that I couldn’t console.log anything from inside a data binding conversion function.
Here’s the relevant bits of my code:
new go.Binding("strokeWidth", "bold", function (e) {
console.log("BOLD BINDING FIRED"); //purely for testing, this never fires...
return e ? 3 : 1 // ...even though this is working
}),
new go.Binding("strokeDashArray", "bold", function (e) {
//I'm worried this will hurt performance, but it's currently my best idea
const gidNodesInView = myDiagram.findNodesByExample({gid: gidIn}); //get all instances of gid in view
console.log("Updating bindings: " + gidNodesInView.count()); //this also never fires (and doesn't set the strokeDashArray either, but that's not my immediate question)
return gidNodesInView.count()>1 ? [10, 5] : [5, 0]
})),
This is another in my string of probably very obvious quesitons - but why am I getting no console logs, even though the data binding is properly toggling my strokeWidth?