-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I want create a popupmenu and load it as context menu, but it doesn't work.
The context menu must be appended by a compnent which is its parent ? Help me, thanks !
Menupopup menupopup = new Menupopup(); Menuitem itemSelectAll = new Menuitem("SelectAll"); itemSelectAll.addEventListener("onClick", new EventListener() { public void onEvent(org.zkoss.zk.ui.event.Event event) throws Exception { .... } }); menupopup.appendChild(itemSelectAll); menupopup.appendChild(itemInverse); ((Listheader) header).setContext(menupopup);
I try use menupopup.setPage(this.getPage()), and it run OK. Thanks very much !
Menupopup menupopup = new Menupopup(); Menuitem itemSelectAll = new Menuitem("SelectAll"); itemSelectAll.addEventListener("onClick", new EventListener() { public void onEvent(org.zkoss.zk.ui.event.Event event) throws Exception { .... } }); menupopup.appendChild(itemSelectAll); menupopup.appendChild(itemInverse); // it's here .... <------------------------------ menupopup.setPage(header.getPage()); ((Listheader) header).setContext(menupopup);
In easiest way, have a look what is the window component which is outer of your stuff and set it as parent.
menupopup.setParent(outerWindow);
Ups, my fault. The parent of a MenuPopup is menu.
If the root tag is 'window', it's OK! But it's parent is tag 'center', and root tag is 'zk' which use getParent() return null.
<zk> <borderlayout> <center> <listbox ....> .... </listbox> </center> </borderlayout> </zk>
Asked: 2013-01-18 02:37:51 +0800
Seen: 88 times
Last updated: Jan 21 '13