带有 ZK 中按钮的呼叫窗口



我有这个代码:

<?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

有人可以帮助我吗?

首先,这个

<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();
       }
    }

相关内容

  • 没有找到相关文章

最新更新