Hi,
I’m trying to implement link of my diagram following:
1.No more than one link between 2 groups can be displayed when one of them is collapsed
2.A link is displayed between 2 groups if there is at least one link between two tables located in those groups
3.If two groups are expanded then links between tables should be displayed. (See next slide)
AND I am using this API group.findLinksConnected() to get link of Group. But result allways return count=0.
Please refer to this jsfiddle https://jsfiddle.net/tiepna/aL08ms24/4/
And click expand button of AdministeredItem group.( see in Handle Expand/Collapse Events)
var groupTempl = $(go.Group, “Auto”,
{
fromSpot: go.Spot.AllSides,
toSpot: go.Spot.AllSides,
isSubGraphExpanded:false
},
new go.Binding(“location”, “”, toLocation).makeTwoWay(go.Point.stringify),
$(go.Shape, “Rectangle”, { fill: “white”, stroke: “#4472C4”, strokeWidth: 2 }),
$(go.Panel, go.Panel.Vertical, // title above Placeholder
$(go.Panel, go.Panel.Horizontal, // button next to
// TextBlock
{ stretch: go.GraphObject.Horizontal, margin: 1 },
$(“SubGraphExpanderButton”,
{ alignment: go.Spot.Right, margin: 5, click: function(e, button) {
var group = button.part;
if (group instanceof go.Adornment) group = group.adornedPart;
if (!(group instanceof go.Group)) return;
var diagram = group.diagram;
if (diagram === null) return;
var cmd = diagram.commandHandler;
if (group.isSubGraphExpanded) {
if (!cmd.canCollapseSubGraph(group)) return;
} else {
if (!cmd.canExpandSubGraph(group)) return;
}
e.handled = true;var linksToGroupOnly = group.findLinksConnected(); var externalLinksConnected = group.findExternalLinksConnected(); var externalNodesConnected = group.findExternalNodesConnected(); diagram.startTransaction("expand-collapse"); if (group.isSubGraphExpanded) { cmd.collapseSubGraph(group); // show link between group and hide links inside group. showGroupLinkGroup(externalLinksConnected,linksToGroupOnly); } else { cmd.expandSubGraph(group); //hide Groups link, show links inside group hideGroupLinkGroup(group,externalNodesConnected,externalLinksConnected,linksToGroupOnly) } diagram.commitTransaction("expand-collapse"); } }), $(go.TextBlock, { alignment: go.Spot.Left, margin: 5, font: "bold 18px 'Open Sans'", stroke: "#4472C4" }, new go.Binding("text", "label")) ), // end Horizontal Panel
$(go.Panel, go.Panel.Position, $(go.Placeholder,{padding:5}) ) )
);