Get key from after ungrouped a node

Hi,
After ungrouping a node how to get key of that node?

Here is what the ungroup command does: http://gojs.net/latest/api/symbols/CommandHandler.html#ungroupSelection

In general there might be any number of nodes and links that are selected after the ungrouping.

To get the key for a Node or simple Part: p.data.key, or more generally:

  myDiagram.model.getKeyForData(p.data)

Actually I need to get the key of ungroupped node. I have tried to get that ungrouped node data from SelectionDeleted/ SelectionUngrouped/ Commandandler.UngroupSelection but I am not able to get ungroupped node data’s.

I suppose you could override CommandHandler.ungroupSelection to record the group.data.key of either the argument Group or of all of the selected ungroupable Groups before calling the base method.

Thanks, I got it.
class CustomCommandHandler extends go.CommandHandler{

public ungroupSelection(group:any){
            console.log(this.diagram.selection.first().data)
    super.ungroupSelection();

}

}