I tried the id ref approach in this fiddle (http://zkfiddle.org/sample/it2qvp/1-context-menu-via-id-ref) and it still works for me
cor3000 ( 2015-12-24 02:06:39 +0800 )edit-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Something seemed to have changed in ZK8 related to how I'm trying to use a reference to my listitem context.
I'm passing a reference of my listitem context to provide a right click popup on a listbox in an include file. The following worked just fine in ZK7, but in ZK8, the context popup never fires. (I don't see any errors showing up either, just no right click popup.) Any ideas if I'm doing something wrong? I'm stumped also since this zk fiddle works illustrating what I'm trying to do and it looks like it's using ZK8 so not sure went wrong. Maybe something I need in my ZK8 pom that I'm missing relative to Zk7 ?
UPDATED. I created the test case out on github here https://github.com/rickcr/zk-context
For reference here are the two zul files. Again, works in 7.0.4.. not in 8.0.0
<?page title="Context Test" ?>
<zk>
<vlayout apply="org.zkoss.bind.BindComposer" id="outerPage"
viewModel="@id('vm') @init('net.learntechnology.example.viewmodel.OuterVM')" vflex="1" hflex="1" style="overflow:auto;">
<groupbox hflex="1" mold="3d" closable="false" vflex="1">
<caption >
<label value="@load(vm.title)"/>
</caption>
<vlayout id="itemsContainer" vflex="1" hflex="1">
<menupopup id="itemsPopup"
onOpen="@command('openContextMenu', open=event.open, item=event.reference.value)">
<menuitem label="Edit Item" onClick="@command('editItem')" />
</menupopup>
<include mode="instant" vflex="1" src="/pages/include.zul"
contextMenuId="@ref(itemsPopup)" />
</vlayout>
</groupbox>
</vlayout>
</zk>
include.zul
<vlayout apply="org.zkoss.bind.BindComposer" vflex="1" hflex="1" style="overlap:auto"
viewModel="@id('vm') @init('net.learntechnology.example.viewmodel.IncludeVM')">
<label context="@init(contextMenuId)" value="Context Menu Test"></label>
<listbox id="itemsList" model="@load(vm.items)" hflex="1" vflex="1">
<listhead sizable="true">
<listheader label="Name" align="left" width="250px"/>
</listhead>
<template name="model" var="item">
<listitem
context="@init(contextMenuId)"
value="@load(item)">
<listcell label="@load(item)"/>
</listitem>
</template>
</listbox>
</vlayout>
tracked issue: http://tracker.zkoss.org/browse/ZK-3044
Workaround is to use the popup ID
<include mode="instant" vflex="1" src="/pages/include.zul"
contextMenuId="@ref(itemsPopup.id)" />
OR
<include mode="instant" vflex="1" src="/pages/include.zul"
contextMenuId="@ref('itemsPopup')" />
I tried the id ref approach in this fiddle (http://zkfiddle.org/sample/it2qvp/1-context-menu-via-id-ref) and it still works for me
cor3000 ( 2015-12-24 02:06:39 +0800 )editAsked: 2015-12-17 04:11:27 +0800
Seen: 39 times
Last updated: Dec 23 '15
ZK popup Component Issue [closed]
ZK 7.0 popup type toggle, Lazy loading
Context menu by left click on menu item. It's work by right click
How to call command method onClick='self.nextSibling.open(self, "after_end")' ?
how to remove popup with massage "Failed to send requests to server"
Same behavior if you change context to popup? (left click in stead of right click)
chillworld ( 2015-12-17 06:14:21 +0800 )edit@Chill popup didn't work either. I created a simple sample maven project here https://github.com/rickcr/zk-context to illustrate the issue. If you switch from 8.0.0 to 7.0.4 you'll see the issue when you right click. Let me know if there any issues with the sample project.
rickcr ( 2015-12-17 14:28:19 +0800 )editI"ll check tomorrow.
chillworld ( 2015-12-17 15:11:56 +0800 )editSorry didn't have time today. I'll try as soon as possible
chillworld ( 2015-12-18 13:47:44 +0800 )editI know busy time of the year. If you think it's something I should put a bug ticket in for, just let me know.
rickcr ( 2015-12-22 19:44:26 +0800 )edit