I’ve just upgraded the version of go.js I’m using following a license purchase and am getting some errors relating to the binding I have on a link that allows me to check if the link is to/from a specific category of item [namely a comment - whereby I remove the arrows from the line).
I’ve highlighted the line below. this is giving the error:
</font>
<font face="Courier New, Courier, mono" color="#ff0000">Binding error: undefined target property: on Shape(None)#{all link shape id's}</font>
<font face="Courier New, Courier, mono" color="#ff0000">
The offending binding is
<span style="font-family: 'Courier New', Courier, mono; font-size: small; line-height: 18.2000007629395px; : rgb248, 248, 252;">}, </span><b style="font-family: 'Courier New', Courier, mono; font-size: small; line-height: 18.2000007629395px; : rgb248, 248, 252;"><font color="#ff0000">new go.Binding("", "", function(obj) { linkClick(obj);</font></b><span style="font-family: 'Courier New', Courier, mono; font-size: small; line-height: 18.2000007629395px; : rgb248, 248, 252;"> })
The LinkTemplate for the link is:
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;">myDiagram.linkTemplate =</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> </span>$$(go.Link, // the whole link panel</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> </span>{</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> </span>routing: go.Link.AvoidsNodes</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> ,</span>curve: go.Link.JumpOver</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> ,</span>corner: 5</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> ,</span>toShortLength: 4</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> ,</span>relinkableFrom: isAdmin</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> ,</span>relinkableTo: isAdmin</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> ,</span>reshapable: isAdmin</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> ,</span>selectable: isAdmin</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> </span>},</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> </span>$$(go.Shape, // the link path shape</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> </span>{</span></font><span ="apple-tab-span"="" style="line-height: 18.2000007629395px; font-family: 'Courier New', Courier, mono; font-size: small; white-space: pre;"> </span><span style="line-height: 18.2000007629395px; font-family: 'Courier New', Courier, mono; font-size: small;">isPanelMain: true</span>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> </span>,</span></font><span style="line-height: 18.2000007629395px; font-family: 'Courier New', Courier, mono; font-size: small;">strokeWidth: linkArrowWidth</span>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> </span>}, <b><font color="#ff0000">new go.Binding("", "", function(obj) { linkClick(obj);</font></b> })</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> </span>),</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> </span>$$(go.Shape, // the arrowhead</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> </span>{</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> </span>toArrow: linkArrowHeadType</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> ,</span>stroke: linkArrowHeadStroke</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> ,</span>fill: linkArrowHeadFill</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> </span>})</span></font>
<font face="Courier New, Courier, mono" size="2"><span style="line-height: 18.2000007629395px;"><span ="apple-tab-span"="" style="white-space:pre"> </span>);</span></font>
If I just remove the line then I can’t apply the category I need to style the line on reloading – are there any safe binding options? (and where should I have looked in the documentation?)
UPDATE:
After trying various logical hooks I happened upon the following:
new go.Binding(“click”, “click”, function(obj) { linkClick(obj);
Now I don’t get any errors. Although I get warned of any errors and the functionality seems intact - I wondered if this will negate me using anything with an onclick functionality later (although I guess? i’d just append this to the linkClick event)…
Thanks
Dylan