How to align nodes in a palette

I have a palette with nodes like this:

I’d like to center align the nodes, how would I go about doing this? The initial palette code is like this:

var palette =
    $(go.Palette, "palette", 
        {
            nodeTemplateMap: myDiagram.nodeTemplateMap,
            autoScale: go.Diagram.Uniform 
        });

palette.model.nodeDataArray = [
    { category: EquipmentNodeType.CAMERA, id: "0", nodeType: EquipmentNodeType.CAMERA, text: "Kamera" },
    { category: EquipmentNodeType.SIGN, id: "0", nodeType: EquipmentNodeType.SIGN, text: "Skilt" }
];

I’ve found properties for the palette such as layout: $(go.Gridlayout), but so far my attempts at trying to use it to center align these nodes have failed.

The right-side palette here: https://gojs.net/latest/intro/palette.html

Does seem to have the kind of behavior I want, but it has separate nodes for the palette. And when I tried using the locationObjectName/locationSpot properties on my nodes and the gridlayout it didn’t change anything with my palette, as well as messing up my diagram.

If you make sure your Node.locationSpot is centered along the X axis of your node (go.Spot.Center is most common location spot) then I think you’ll get what you want.

Yes… that worked. Just using locationSpot but not locationObjectName gave me the behavior I needed and didn’t mess with my diagram. Thank you.

We will be getting a license pretty soon I think :) Excellent support here.

A post was split to a new topic: Vertically aligning all items in a Palette