Knowing completion of diagram layout change

Hi Team/Walter,

I am working on a GoJs Diagram with dynamic layout change feature and I want to know if there is any DiagramEvent that gets triggered after the change of diagram layout ?

for eg: when I update the diagram’s initial layout to a LayeredDigraphLayout as below

			myDiagram.layout = $(go.LayeredDigraphLayout,
			{
				isInitial : false,
				isOngoing : false,
				layeringOption :go.LayeredDigraphLayout.LayerLongestPathSource,
				layerSpacing : 100,
				columnSpacing : 50,
				setsPortSpots : false,
				angle : _angle
			}
		);`

I tried to listen to LayoutCompleted event, but I don’t think this event is called after the layout is updated.

thanks,
Manoj

The “LayoutCompleted” DiagramEvent is what you want.

In your case quoted above the layout does not happen automatically because you have set Layout.isInitial and isOngoing to false, so it doesn’t get the chance to complete.

But obviously you can execute whatever you want in your own code after setting Diagram.layout.

1 Like

Thanks @walter, i appreciate it :)