0

Passing listitem context working in zk7 not zk8

asked 2015-12-17 04:11:27 +0800

rickcr gravatar image rickcr
704 7

updated 2015-12-17 14:35:41 +0800

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>
delete flag offensive retag edit

Comments

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 )edit

I"ll check tomorrow.

chillworld ( 2015-12-17 15:11:56 +0800 )edit

Sorry didn't have time today. I'll try as soon as possible

chillworld ( 2015-12-18 13:47:44 +0800 )edit

I 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

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-12-23 03:47:55 +0800

cor3000 gravatar image cor3000
6280 2 7

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')"  />
link publish delete flag offensive edit

Comments

thank you! The latter worked in my project (the one with the single quotes), the former didn't seem to work however.

rickcr ( 2015-12-23 16:14:15 +0800 )edit

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
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2015-12-17 04:11:27 +0800

Seen: 39 times

Last updated: Dec 23 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More