Problem in group collapse

I m working on a diagram with base as tree mapper i have another problem in group collapse.
When i collapse groups they jump around and even overlap on the other group how can i make them collapse in place?

and when i collapse this

That depends on what your Diagram.layout does.

this.diagram.layout = Go(go.GridLayout, {
      wrappingWidth: Infinity,
      alignment: go.GridLayout.Position,
      cellSize: new go.Size(1, 1),
      spacing: new go.Size(50, 50),

Ah – that’s the problem: you have set Layout.isOngoing to false.