1

我有这个代码:

<?xml version="1.0" encoding="UTF-8"?>

    <zk>
        <style src="/widgets/grid/inline_row_editing/style.css" />
        <div apply="org.zkoss.bind.BindComposer"
     viewModel="@id('vm')     @init('com.gemalto.segmentation.viewModel.users.InplaceEditingViewModel')">

    <window id="MnoNEWin" title="Mnos" width="300px" visible="false" minimizable="true" border='normal'>
        <listbox id="listNE" model="@bind(each.mnoList)" >
            <listhead>
                <listheader label="Mnos" sort="auto" />
            </listhead>
        </listbox>
    </window> 

    <grid id="demoGrid"
          model="@load(vm.languageContributions) @template((vm.displayEdit and     each.editingStatus) ? 'editable' : 'noneditable')">
        <auxhead>
            <auxheader colspan="4"
                       label="Create Users">
                <hlayout>
                    <label />
                    <button label="create" 
                            onClick="@command('onAddNew', languageContributionStatus=each)" />
                    <checkbox checked="@bind(vm.displayEdit)"
                              label="Enable Multiple Inline Row Editing">
                    </checkbox>
                </hlayout>
            </auxheader>
        </auxhead>

        <columns>
            <column width="160px">Email</column>
            <column width="160px">Password</column>
            <column width="160px">Confirm-Password</column>
            <column width="160px">Role</column>
            <column width="160px">Mnos</column>
            <column width="110px" visible="@load(vm.displayEdit)">Edit</column>
            <column width="110px" visible="@load(vm.displayEdit)">Remove</column>
        </columns>
        <rows>
            <template name="editable">
                <row>
                    <textbox
                        value="@load(each.languageContribution.email)
    @save(each.languageContribution.email, before='confirm')" /> <textbox     value="@load(each.languageContribution.password) @save(each.languageContribution.password,     before='confirm')"/> 
<textbox value="@load(each.languageContribution.password)         @save(each.languageContribution.confirmPass, before='confirm')"/> 
<textbox value="@load(each.languageContribution.role)     @save(each.languageContribution.role, before='confirm')"/>

                    <button id="MnoE" label="Mnos"/>

                    <window id="MnoEWin" title="Mnos" width="300px" visible="false"     minimizable="true" border='normal'>
                        <listbox id="listNE" model="@bind(each.mnoList)" >
                            <listhead>
                            <listheader label="Mnos" sort="auto" />
                            </listhead>
                        </listbox>
                    </window> 

                    <button
                        label="save"
                        onClick="@command('confirm', languageContributionStatus=each)"     />
                    <button
                        label="cancel"
                        onClick="@command('changeEditableStatus2',     languageContributionStatus=each)" />


                </row>
            </template>


            <template name="noneditable">
                <row>
                    <label value="@load(each.languageContribution.email)" />
                    <label value="@load(each.languageContribution.password)" />
                    <label value="@load(each.languageContribution.password)" />
                    <label value="@load(each.languageContribution.role)" />

                    <button label="Mnos">
                        <attribute name="onClick"><![CDATA[
        if (!@load(each.languageContribution.email).isVisible())
            @load(each.languageContribution.email).setVisible(true);
        @load(each.languageContribution.email).doHighlighted();
    ]]></attribute>
                    </button>
                    <button
                        label="edit"
                        onClick="@command('changeEditableStatus', languageContributionStatus=each)" />

                    <window id="@load(each.languageContribution.email)"  title="Mnos"     width="300px" visible="false" minimizable="true" border='normal'>
                        <listbox id="listNE" model="@bind(each.mnoList)" >
                            <listhead>
                                <listheader label="Mnos" sort="auto" />
                            </listhead>
                        </listbox>
                    </window> 
                </row>
            </template>
        </rows>


    </grid>
</div>
</zk>

我有一个问题,因为在窗口

                <button label="Mnos">
                    <attribute name="onClick"><![CDATA[
    if (!@load(each.languageContribution.email).isVisible())
        @load(each.languageContribution.email).setVisible(true);
    @load(each.languageContribution.email).doHighlighted();
]]></attribute>
                </button>
                <button
                    label="edit"
                    onClick="@command('changeEditableStatus', languageContributionStatus=each)" />

                <window id="@load(each.languageContribution.email)"  title="Mnos" width="300px" visible="false" minimizable="true" border='normal'>
                    <listbox id="listNE" model="@bind(each.mnoList)" >
                        <listhead>
                            <listheader label="Mnos" sort="auto" />
                        </listhead>
                    </listbox>
                </window>

当单击按钮 Mno 窗口时,我需要它:

<window id="@load(each.languageContribution.email)"

出现,但它的窗口对我拥有的每个用户都有一个 id,并且不知道我该怎么做按钮调用窗口,就像一个弹出窗口一样,比如:

http://www.zkoss.org/zkdemo/effects/login_effect

有人可以帮助我吗?

4

1 回答 1

1

首先,这

<attribute name="onClick"><![CDATA[
        if (!@load(each.languageContribution.email).isVisible())
            @load(each.languageContribution.email).setVisible(true);
        @load(each.languageContribution.email).doHighlighted();
    ]]></attribute>

不起作用,因为 @load 不会在这个地方进行评估。
如果不知道id,可以使用zul结构获取Component

<button label="Mnos" onClick="@command('openWindow', window = self.nextSibling )">

在虚拟机中

 @Command
    public void openWindow(@BindingParam("window") Window win){
       if(!win.isVisible()){
          win.setVisible(true);
          win.doHighlighted();
       }
    }
于 2013-09-25T08:32:18.960 回答