I have the following definition for a contextMenu on my Go diagram
SeatingMapGraphicsRef.contextMenu =
$(go.Adornment, "Vertical",
// no binding, always visible button:
$("ContextMenuButton",
$(go.TextBlock, "Hold Seats"),
{ click: function(e, obj) {
holdSeatsInDragSelect();
} }),
$("ContextMenuButton",
$(go.TextBlock, "Select Seats"),
{ click: function(e, obj) {
} }),
$("ContextMenuButton",
$(go.TextBlock, "Lock Seats"),
{ click: function(e, obj) {
} }),
$("ContextMenuButton",
$(go.TextBlock, "Cancel"),
{ click: function(e, obj) {
var diagram = e.diagram;
diagram.hideContextMenu();
} })
);
However when I write this, I get the following error:
Error: Diagram.contextMenu value is not an instance of Adornment
How exactly is this the case?
Here is my definition of SeatingMapGraphicsRef
function generateMap() {
SeatingMapGraphicsRef =
GO(go.Diagram, "mapBodyDiv", // the DIV HTML element
{
initialContentAlignment: go.Spot.Center,
initialAutoScale:go.Diagram.Uniform,
"toolManager.mouseWheelBehavior": go.ToolManager.WheelZoom
});
And finally here is the reference page on ContextMenus from which I took the contextMenu definition on a diagram level.
Because you started to use:
Instead of the (common in the samples):
Presumably because you're using jQuery too.
It will probably work if you change all the
$toGOin your Adornment definition