Hi,
I followed this post: [Get reference to parent object in model from itemArray for binding]
Here’s code (the itemTemplatepart):
[...]
itemTemplate:
$gj(go.Panel,
{
_side: "right",
fromSpot: go.Spot.Right, toSpot: go.Spot.Right,
fromLinkable: false, toLinkable: false,
cursor: "pointer"
//contextMenu: portMenu
},
new go.Binding("portId", "portId"),
$gj(go.Shape, "Rectangle",
{
stroke: null, strokeWidth: 0,
desiredSize: portSize,
margin: new go.Margin(3, 0),
//fill: "blue"
}
new go.Binding("fill", "color", function(color, shape) { return shape.part.data.horiz; })
),
[...]
the data example:
{"isGroup":true, "text":"Prodotto", "loc":"572.0456949966161 150.04569499661574", "horiz":"#33D3E5", "rightArray":[ {"portId":"Ambito", "checked":true},{"portId":"Scalo", "checked":true},{"portId":"Profit", "checked":true} ], "source":"/FILL_EM/img/mult.png", "key":-1, "group":-4}
The code does not work. No error but the shapes around ports remain black. What I try to do is simply to get the “horiz” property, that contains the color, and use it to fill the color of the box around ports in the group.
Any helps?
thx