popup-menu subarray and method

Hi,

I have a question about the popupmenu plugin, i would like to create a menu where an item contains a submenu, but when you click on that item it will trigger a method. Is that possible?

Yes that is possible.
You can push a sample solution and/or check documentation to see how.

I’m not sure if I was clear enough to illustrate the problem…
I’ll try to explain it with an example:

When i have this popup menu:

menu1

submenu1
submenu2
submenu3

in code that would be:

var submenu = new Array();
submenu[0] = plugins.popupmenu.createMenuItem(‘submenu1’);
submenu[1] = plugins.popupmenu.createMenuItem(‘submenu2’);
submenu[2] = plugins.popupmenu.createMenuItem(‘submenu3’);

var menu = new Array(
plugins.popupmenu.createMenuItem(‘menu1’, submenu));

Is it possible to attach a method to the menu1 item?

menu1

submenu1
submenu2
submenu3

So you mean menu1, being a (sub)menu and not a menu item. In that case the answer is no.

If I get that right, the menu1 is a submenu, that means it shows more nested menu items. Such a menu cannot be selected by itself and therefore cannot fire a method. Of course, all of the submenu items can.

Marcel is a fast typer :D

Or a fast reader :)

yes, that’s the case… I ‘solved’ it to add an extra submenu item, like this:

menu1

put here…
submenu1
submenu2
submenu3

Thanks for the quick response!