I would like to update some list panels when my GoJS diagram is clicked. The click event fires everytime, but sometimes this
ends up being null
within the event, and I can't access the rest of my panel. Any ideas why this might be?
myDiagram.linkTemplate =
$(Link,
$(Shape,
{ strokeWidth: 1, stroke: "gray" },
$(Shape, new Binding("fromArrow", "fa")),
$(Shape, new Binding("toArrow", "ta")),
{
click: (e: go.InputEvent, obj: go.GraphObject, ) => {
console.log('[nav123] starting click');
this.listPanelA.scrollToRow(obj['pb'].rowNumber);
this.listPanelB.scrollToRow(obj['pb'].rowNumber);
}
});
Thanks!
Use the
e
andobj
arguments instead ofthis
, which is difficult to predict in JavaScript, because you do not know the context that calls the event.