Visible binding on adornment not triggered

I believe this might be similar to this question Adornment & Databinding Question

I’m adding a selectionAdornmentTemplate to a nodeTemplate. which is basically like an expanding button which I’m checking to see if is visible based on a property, but this only seems to be triggered before I do any work.

Flow is: click on node, goes to check property in template

 new gojs.Binding('visible', 'connectionsDown', function (h, shape) {
        if (shape.part.data.hasConnections && h) {
          return true;
        }
      }),

then goes to my function where I update the 2 properties “hasConnections” and “connectionsDown”

   myDiagram.model.setDataProperty(node, 'hasConnections', connections);
   myDiagram.model.setDataProperty(node, 'connectionsDown', true);

I was expecting trigger in visible binding to be called again.

NOTE: I’m starting with this 2 properties as False and the visible property is also defaulted to False

Any help/advice?

What is the value of node? Did you mean instead node.data?

BTW, your Binding conversion function ought to always return true or false, not sometimes undefined. I suggest:

new go.Binding("visible", "",
      function(data) { return data.hasConnections && data.connectionsDown; })

node is = myDiagram.findNodeForKey(uniqueId);

Ah, so that is the problem. Diagram.findNodeFor… returns a Node, which is not data in a Model. Model.setDataProperty has to take a data object in the model. Hence:

myDiagram.model.setDataProperty(node.data, "hasConnections", connections);

Thank you Walter. that was it.