Inserting object into item Array

Dear sir,
In gojs seating chart i am used item array for arranging the seats around tables. Now i want to insert the seat to item array i tried like this

myDiagram.nodeTemplateMap.add(“SquareTemp”,
$$(go.Node, “Spot”, tableStyle(),
$$(go.Panel, “Spot”,
$$(go.Shape, “Rectangle”,
{
///////////////////////////
),
$$(go.TextBlock,
///////////////////////////////////////
),
new go.Binding(“itemArray”,“items”),
{
itemTemplate:
$$(go.Panel, “Spot”,
new go.Binding(“direction”,“dir”),
new go.Binding(“name”, “id”),
new go.Binding(“alignment”, “align”),
new go.Binding(“alignmentFocus”, “focus”),
$$(go.Shape, { width: 45, height: 45 },
///////////////////////////////////
),
$$(go.TextBlock, new go.Binding(“text”, “sno”).makeTwoWay(),
/////////////////////////////////
)
)
)
}
)
);

var newnode = { category: “SquareTemp”, key: “100”, “guests”: {}, name:“Square”, items: [{ sno: “1”, id: “1”, align: new go.Spot.parse(“0.2 0”), focus: new go.Spot.parse(“0.5 1”), rte: 0,dir:“top”}, { sno: “1”, id: “2”, align: new go.Spot.parse(“0.6 0”), focus: new go.Spot.parse(“0.5 0”), rte: 0, dir:“top”}]};
myDiagram.model.addNodeData(newnode);

Now i used fallowing statement to insert seat to item array


myDiagram.model.findNodeForKey(100).addArrayItem(“items”,{ sno: “1”, id: “3”, align: new go.Spot.parse(“0.8 0”), focus: new go.Spot.parse(“0.5 0”), rte: 0, dir:“top”})


But its not working could you please help me how to add or insert seat object to the item array

Regards,
AR

The whole node basically consists of some chairs arranged around a table. That is implemented by the Node itself acting as a Spot Panel, where the table is the main object and the chairs/seats are arranged relative to the table using alignment & alignmentFocus properties.

But the table object can be arbitrarily complex. In this sample the table is itself a Panel so that there can be both a Shape and a TextBlock. That Panel happens to also be a Spot Panel, and this panel is the main (first) element in the Node.

So if you want to use Panel.itemArray and Panel.itemTemplate, you need to set or bind those on the right Panel. In your case I think you want to do it on the main panel, the whole Node. But your code above appears to be doing it on the nested panel, which is just the table object. I think you do not want to embed the chairs into the table furniture – the chairs should go around the table.