Create dynamic multilevel Context menu with NodeDataArray's data

Hi,

I want to create a dyanamic multilevel context menu where data will come from NodeDataArray.

I found samples of multilevel context menu with hard coded html content.I want to make it fully dyanamic.

like this

ClickableObjects2

I wan to add one more thing, this context menu option may change group by group.

How it can be done with GoJS?

If you want to implement it using HTML, then it really isn’t a GoJS question. Search the web for examples of how to do that using whichever framework you are using, if any.

Have you seen the implementation of the HTML context menu in HTML Context Menu ?

I have seen implementation of html context menu. But I want to have it diffrent at group level not same cntext menu for each groups.

I am planning to have multiple ctx element. can i put this in a function and call from groupTemplate

var cxElement = document.getElementById(“contextMenu”);

  // Since we have only one main element, we don't have to declare a hide method,
  // we can set mainElement and GoJS will hide it automatically
  var myContextMenu = $(go.HTMLInfo, {
    show: showContextMenu,
    mainElement: cxElement
  }); 

here ctxelement will be unique for each group.

I suppose you could have a Binding on GraphObject.contextMenu that uses a conversion function that returns the desired HTMLInfo.

But it’s more common to use a single HTML element and instead customize its contents in the HTMLInfo.show function. There can be at most one context menu at a time, so it’s perfectly reasonable to modify the one HTML element that you use.