[SOLVED] Remove a node property dynamically

Hi,

When I drop a node from Palette to Diagram I want to remove a certain property of that node

myPalette =
$(go.Palette, “myPalette”, {
maxSelectionCount: 1,
padding: PAL_PADDING,
nodeTemplateMap: flowchart.nodeTemplateMap,
“animationManager.isEnabled”: false,
“contextMenuTool.isEnabled”: false,
linkTemplate: $(go.Link, { //links template just for this Palette
routing: go.Link.AvoidsNodes,
curve: go.Link.JumpOver,
corner: 5,
toShortLength: 4,
selectionAdornmentTemplate: $(go.Adornment, “Link”,
{ locationSpot: go.Spot.Center },
$(go.Shape, { isPanelMain: true, fill: null, stroke: “deepskyblue”, strokeWidth: 1}),
$(go.Shape, { toArrow: “Standard”, stroke: null })
)
},
new go.Binding(“points”),
$(go.Shape, { isPanelMain: true, strokeWidth: 1 }),
$(go.Shape, { toArrow: “Standard”, stroke: null })
),
model: new go.GraphLinksModel([
{ category: “start”, eventFigure: “Empty”, tt: “Evento de inicio de un Proceso” }
])
});

myDiagram.addDiagramListener(“ExternalObjectsDropped”, function(e) {
var newnode = flowchart.selection.first(); //always dropping from palette
//HERE REMOVE THE “tt” PROPERTY OF NODE
});

How can I remove a node property dynamically?

Regards,

    var newnode = flowchart.selection.first();
    delete newnode.data["tt"];

Of course you really ought to iterate over the Diagram.selection, in case more than one thing was dropped onto the diagram.

It works, Thanks! :thumbsup: