Hi,
I am having an group template with nodes as shown:
but when I am deleting the links between the nodes and submitting it as shown:
the nodes are getting disarranged as shown:
how to prevent it the code is as follows for the group template:
this.graph.groupTemplate = this.diagram(go.Group, “Auto”, nodeStyle,
new go.Binding(“location”, “loc”, go.Point.parse).makeTwoWay(go.Point.stringify),
new go.Binding(“isSubGraphExpanded”).makeTwoWay(),
{
layout: this.diagram(go.LayeredDigraphLayout,
{
direction: 0, columnSpacing: 10,
isOngoing: false,
}),
mouseDragEnter: function (e, grp, prev) { highlightGroup(e, grp, true); },
mouseDragLeave: function (e, grp, next) { highlightGroup(e, grp, false); },
computesBoundsAfterDrag: false,
mouseDrop: finishDrop,
handlesDragDropForMembers: false
},
this.diagram(go.Shape, "RoundedRectangle", // surrounds everything
new go.Binding("background", "isHighlighted", function (h)
{ return h ? "rgba(255,0,0,0.2)" : "transparent"; }).ofObject(),
{
parameter1: 5,
fill: "rgba(128,128,128,0.33)"
}
), this.diagram("Button",
{
alignment: go.Spot.TopRight,
"_buttonFillNormal": "#000000",
"_buttonStrokeNormal": "#FFFFFF",
"_buttonFillOver": "#000000",
"_buttonStrokeOver": "#FFFFFF"
},
this.diagram(go.Shape, "XLine", { width: 5, height: 5, stroke: "#ff0000" }),
{ click: this.deleteSegmentwithConfirm }),
makePort(this, "T", go.Spot.Top, false, true),
this.diagram(go.Panel, "Vertical", // position header above the subgraph
{ defaultAlignment: go.Spot.TopLeft },
this.diagram(go.Panel, "Horizontal", // the header
{ defaultAlignment: go.Spot.Top },
this.diagram(go.TextBlock, // group title near top, next to button
{ font: "Bold 12pt Sans-Serif", alignment: go.Spot.Left, },
new go.Binding("text", "text")),
this.diagram("SubGraphExpanderButton", { margin: new go.Margin(3, 3, 5, 5), alignment: go.Spot.Right }) // this Panel acts as a Button
),
this.diagram(go.Placeholder, // represents area for all member parts
{ padding: new go.Margin(0, 10), background: "transparent" }),
makePort(this, "B", go.Spot.Bottom, true, false)
)
);