3

Is there a way to get to the parent Node or the parent GraphObject's in general in GoJS? I'm inside a TextBlock and need access to the model data in the click handler. Panel.findObject(id) only works from top to botton in the object hierarchy and a TextBlock has no access to that method either way. I tried diagram.findNodeForKey, if I get access to the key from the child element, but same problem here. I thought there has to be a simple way to get to the parent `Node/Part somehow, but I didn't find any suitable function for that in the API.

As a workaround I use diagram.selection.first().data at the moment to get to the Node and the bound model data, it works in my case, but seems a little dirty.

xander
  • 1,780
  • 9
  • 16

1 Answers1

4

Is there a way to get to the parent Node or the parent GraphObject's in general in GoJS?

You can call graphobject.panel to get the GraphObject's panel (if it exists), or graphobject.part to get the GraphObject's Part.

Simon Sarris
  • 62,212
  • 13
  • 141
  • 171