I’ve been trying to do it like this:
var fieldTemplate =
$(go.Panel, "TableRow", // this Panel is a row in the containing Table
new go.Binding("portId", "name"), // this Panel is a "port"
{
background: "transparent", // so this port's background can be picked by the mouse
fromSpot: go.Spot.LeftRightSides, // links only go from the right side to the left side
toSpot: go.Spot.LeftRightSides,
// allow drawing links from or to this port:
fromLinkable: true, toLinkable: true
},
{ // allow the user to select items -- the background color indicates whether "selected"
//?? maybe this should be more sophisticated than simple toggling of selection
click: function(e, item) {
// assume "transparent" means not "selected", for items
var oldskips = item.diagram.skipsUndoManager;
item.diagram.skipsUndoManager = true;
if (item.background === "transparent") {
item.background = "dodgerblue";
} else {
item.background = "transparent";
}
item.diagram.skipsUndoManager = oldskips;
var inspector = new Inspector('info', myDiagram,
{
properties: {
// key would be automatically added for nodes, but we want to declare it read-only also:
"key": { readOnly: true, show: Inspector.showIfPresent },
// fill and stroke would be automatically added for nodes, but we want to declare it a color also:
"fill": { show: Inspector.showIfPresent, type: 'color' },
"stroke": { show: Inspector.showIfPresent, type: 'color' }
}
}
)
}
},
$(go.Shape,
{ width: 12, height: 12, column: 0, strokeWidth: 2, margin: 4,
// but disallow drawing links from or to this shape:
fromLinkable: false, toLinkable: false },
new go.Binding("figure", "figure"),
new go.Binding("fill", "color")),
$(go.TextBlock,
{ margin: new go.Margin(0, 2), column: 1, font: "bold 13px sans-serif",
// and disallow drawing links from or to this text:
fromLinkable: false, toLinkable: false },
new go.Binding("text", "name")),
$(go.TextBlock,
{ margin: new go.Margin(0, 2), column: 2, font: "13px sans-serif" },
new go.Binding("text", "info"))
);
I’ve added an info div at the bottom of the page… but it doesn’t work