gpt4 book ai didi

java - ZK 中带按钮的调用窗口

转载 作者:太空宇宙 更新时间:2023-11-04 07:23:12 24 4
gpt4 key购买 nike

我有这个代码:

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

关于java - ZK 中带按钮的调用窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18983107/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com