I’m trying to remove all elements inside a panel using the following code
var nodeLinks = nodeData.findObject('nodeLinks');
var elemToRemove = [];
_.each(nodeLinks.elements, function (elem) {
elemToRemove.push(elem);
});
_.each(elemToRemove, function (element) {
nodeLinks.remove(elemToRemove);
});
I got the following error:
Error: Panel.remove:element value is not an instance of GraphObject
if i change the remove line for diagram.remove(elemToRemove) i got this error:
Error: Diagram.remove:part value is not an instance of Part
Im doing something wrong. This is the panel just in case:
$(go.Panel, "Vertical",
{ /*background: "#ffff41",*/ name: "nodeLinks", position: new go.Point(110, 0), visible: false },
$("Button",
{ margin:4 }, // defined below, to support editing the text of the node
$(go.TextBlock, "t",
{ font: "bold 10pt sans-serif", desiredSize: new go.Size(15, 15), textAlign: "center" })
),
$("Button",
{ margin:4 }, // defined below, to support editing the text of the node
$(go.TextBlock, "t",
{ font: "bold 10pt sans-serif", desiredSize: new go.Size(15, 15), textAlign: "center" })
),
$("Button",
{ margin:4 }, // defined below, to support editing the text of the node
$(go.TextBlock, "t",
{ font: "bold 10pt sans-serif", desiredSize: new go.Size(15, 15), textAlign: "center" })
)
)