I have defined a context menu for my diagram
with the following function:
SeatingMapGraphicsRef.contextMenu =
GO(go.Adornment, "Vertical",
// no binding, always visible button:
GO("ContextMenuButton",
GO(go.TextBlock, "Hold Seats"),
{ click: function(e, obj) {
holdSeatsInDragSelect();
} }),
GO("ContextMenuButton",
GO(go.TextBlock, "Select Seats"),
{ click: function(e, obj) {
} }),
GO("ContextMenuButton",
GO(go.TextBlock, "Lock Seats"),
{ click: function(e, obj) {
} }),
GO("ContextMenuButton",
GO(go.TextBlock, "Cancel"),
{ click: function(e, obj) {
var diagram = e.diagram;
diagram.hideContextMenu();
} })
);
where SeatingMapGraphicsRef
is a reference to my GOJS diagram
.
After calling defineDiagramContextMenu
(which simply executes the above contextMenu definition) ,
I call the showContextMenu
tool to programmatically display the context menu as opposed to doing the default command.
Here is the line I use to show the context menu
SeatingMapGraphicsRef.toolManager.contextMenuTool.showContextMenu(SeatingMapGraphicsRef.contextMenu);
This gives me the following error:
ContextMenuTool.showContextMenu:obj value is not an instance of GraphObject: undefined
Does anybody understand how it is the case that the contextMenu I created in my function did not create a GraphObject
?