I have been working my way through this for a couple of days, and still can’t seem to figure out what I could possible be doing wrong. Although data is actually being displayed, its NOT using the itemTemplate I’ve created, its just displaying the ‘key’ in the array that its bound to. Also, when I try to switch it from a Horizontal panel to a Table panel, using a TableRow panel (instead of a Horizontal panel), it gets completely crazy, and just puts everything on top of itself…
This is the basic code using a vertical and a horizontal panel.
var groupWithFieldsTemplate =
$(go.Node, "Auto",
{ deletable: false, isTreeExpanded: true },
$(go.Shape, "RoundedRectangle",
{
//fill: "lightgray",
stroke: null, strokeWidth: 0,
stretch: go.GraphObject.Fill,
//width: 600
},
new go.Binding("fill", "scope", scopeBrushConverter)
),
$(go.Panel, "Vertical",
{ stretch: go.GraphObject.Horizontal, defaultAlignment: go.Spot.Left },
$(go.Panel, "Horizontal",
{ stretch: go.GraphObject.Fill, portId: "Fld", toSpot: go.Spot.Left },
$("PanelExpanderButton", "LIST", // the name of the element whose visibility this button toggles
{
width: 20
},
new go.Binding("visible", "fields", function (flds) { return flds.length > 0;})
),
$(go.TextBlock,
{
margin: new go.Margin(5, 25, 5, 5),
verticalAlignment: go.Spot.Top,
stretch: go.GraphObject.Horizontal,
overflow: go.TextBlock.OverflowEllipsis,
font: " bold 12px sans-serif"
},
new go.Binding("text", "key")
)
),
// the collapse/expand area (will be mapped template)
$(go.Panel, "Vertical",
new go.Binding("itemArray", "fields"),
{
//visible: false,
defaultAlignment: go.Spot.Left,
name: "LIST",
stretch: go.GraphObject.Horizontal,
itemTemplate:
$(go.Panel, "Horizontal",
$(go.TextBlock,
{ isMultiline: false, editable: false, margin: 3 },
new go.Binding("text", "dataType")
),
$(go.TextBlock,
{ isMultiline: false, editable: false, margin: 3 },
new go.Binding("text", "key")
)
)
}
)
),
$("TreeExpanderButton", { margin: new go.Margin(0,0,0,25), alignment: go.Spot.Right, alignmentFocus: go.Spot.Top })
);
THis is what a node looks like… it should have 2 textboxes to include dataType and key, but only key is showing