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

Changing category inside a template binding

$
0
0

@turnert wrote:

I have a situation where, depending on the length property of a node, I want to display different templates.

Since this width can change via tools and updates to the node’s data, I have a binding on my template:

new go.Binding("width", "", (nodeData) => {
   if(nodeData.length === 0)
      this.diagram.model.setCategoryForNodeData(nodeData, "SmallTemplate");
   return nodeData.length;
}

I have the inverse logic on my other template (model.length > 0).

What happens is the correct template is chosen initially, and the template will change once when I update the length property, but then the template will never change again, even though I can step through the binding code in my debugger.

Is there a better way to do this?

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles