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

Binding is not updating a Link shape when the model changes

$
0
0

@nikzb wrote:

I have a Link template that includes a binding for the stroke property of the Shape used to display the link.

go.Link,
    {
        selectable: false,
    },
    // use `Normal` routing except for links within a single table
    new go.Binding('routing', '', (linkData: IERDGraphLink) => {
        return linkData.from === linkData.to
            ? go.Link.AvoidsNodes
            : go.Link.Normal;
    }),
    new go.Binding('fromEndSegmentLength'),
    new go.Binding('toEndSegmentLength'),
    make(
        go.Shape,
        {
            fill: '#FFF',
        },
        new go.Binding('stroke', '', (linkData: IERDGraphLink) => {
            return linkData.isConnectedToHoveredTable ||
                linkData.isConnectedToSelectedTable
                ? HIGHLIGHTED_COLOR
                : DARK_BORDER_COLOR;
        }),
...

The stroke will appear correctly based on the initial value of the linkData but when that value is updated in the model, the stroke will not change. When I tried logging the value of the linkData it is still showing the initial values, not the updated values. I confirmed that the values are updating in the model by using the debugger.

Why is the updated linkData not being used in this binding?

Posts: 5

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles