I just thought I’d share this since Dojo’s documentation is lacking useful information. It seems like no matter how many documentation websites the guys at Dojo create, they never fully document everything. Here is a perfect example. I couldn’t for the life of me find out how to programatically create a dijit.PopupMenuItem. Through trial and error I figured this out:
var menuItem = new dijit.PopupMenuItem({
label: "My Item",
iconClass: "myIconClass",
popup: new dijit.Menu()
});
The key being the popup property. If you don’t initialize the popup property with an instance of a new dijit.Menu, the whole thing doesn’t work. You can then use menuItem.popup.addChild(…) to add new menu items to the popup menu item.
Advertisement
One Comment
This reduced my trail & error campaign tremendous. Saved me a lot of hair on my head!