How to get go.Shape portId in onClick event

I’m not sure what your question is. The GraphObject.click event handler is passed two arguments. The second argument is that GraphObject on which the event handler was defined. So:

$(go.Shape, "Circle",
  { . . .,
    portId: . . .,
    click: function(e, shape) {
        console.log("clicked port: " + shape.portId);
    }
  })
1 Like