Hi,
I have the following code. How do I access node data?
const contextMenuGenerator = (nodedata) => {
switch (nodedata.type) {
case value:
break;
default:
break;
}
return map(menuItems,()=>{return ...})
};
const nodeTemplate = $(
go.Node,
'Auto',
{
// handle dragging a Node onto a Node to (maybe) change the reporting relationship
mouseDragEnter: onNodeDragEnter,
mouseDragLeave: onNodeDragLeave,
mouseDrop: onNodeDrop,
},
$(
go.Shape,
'RoundedRectangle',
nodeStyleDefault,
new go.Binding('fill', 'type', changeNodeFillStyle),
new go.Binding('stroke', 'type', changeNodeStrokeStyle),
),
$(
go.TextBlock,
'Default Text',
nodeTextBoxStyle,
new go.Binding('text', 'desc').makeTwoWay(),
),
{
// define a context menu for each node
contextMenu: $(
go.Adornment,
'Vertical', // that has one button
contextMenuGenerator(nodeData),
// more ContextMenuButtons would go here
), // end Adornment
},
$('TreeExpanderButton', nodeTreeExpanderButtonConfig),
);
Thanks,
Chat