How to Find parent Node using the SubgraphKey in GOJS


in GOXAML we found the parent Node using the SubgraphKey.
GOXAML code is :-

simialrly how can we find the parent Node in GOJS.

Thanks & Regards
Amit Kumar Jha

In GoXam that would not find the containing Group in the Diagram but the container data in the Model.

So let us assume that you have some (group member) data object in the model:

    var nodedata = ...;
    var groupkey = model.getGroupKeyForNodeData(nodedata);
    var groupdata = model.findNodeDataForKey(groupkey);

Or if you actually wanted the containing Group in a particular Diagram:

    var group = diagram.findNodeForKey(groupkey);

Remember that there can be multiple Diagrams for the same Model, both in GoXam and in GoJS.

Note also that we have improved the method names in GoJS, to make it clearer whether dealing with model data or Diagram Parts – the former tend to have “data” in the name.

Importantly, both GoXam and GoJS avoid calling Groups “parents”. Groups are “containers” that contain “member parts (nodes and links)”. “Parents” and “children” are reserved for tree structures. Only tree “parent nodes” have “child nodes” and they are always connected by links, unlike the member nodes in a group.