Z-index priority to nodes with category

I want to achieve something like this where I’m Dynamically adding objects/node to following template map,

diagram.nodeTemplateMap.add(“zIndex0”);
diagram.nodeTemplateMap.add(“zIndex1”);
diagram.nodeTemplateMap.add(“zIndex2”);

for
category: zIndex0, I want all the objects in bottom layer.
category: zIndex1, I want it above zIndex0 and
category: zIndex2, on top of all the objects

If you want to control the z-ordering for your nodes, you just need to set or bind the Part.layerName property in your node template. You don’t need more templates.

Please read GoJS Layers -- Northwoods Software

Thanks a lot Walter!