Login Register

Creating context menu dynamically

Hi,

I have many different divs or widgets and I need to create for each of them different context menu, but I can't use ids, because of later I will have maybe hundreds of different menus and items may change often.

Is there any way to do this?

I try this:
var menuWidget = ... // programatically created menu
dijit.popup.open({popup: menuWidget, x: evt.pageX, y: evt.pageY});

but I don't know how to close and open it correctly {like onRightClick: function(){menu.toogle()}}

Thanks