java - Zk 复选框有问题吗?

标签 java checkbox zk

我有一个 DualListBox 的宏组件,其中还包含复选框,如下所示:

<hlayout
    style="padding-left: 40px;padding-top:20px;padding-bottom:20px;"
    hflex="1" vflex="1">
    <separator />

    <listbox id="candidateLb" vflex="true" width="250px"
        multiple="true"   model="${arg.candidateModel}">
        <listhead>
            <listheader label="Default Column List"></listheader>

        </listhead>
        <template name="model" var="each">
            <listitem>
                <listcell label="${each}" />

            </listitem>
        </template>
    </listbox>

    <vbox spacing="10px">
        <image style="cursor:pointer" id="chooseAllBtn"
            src="/images/rightrightarrow_g.png" />
        <image style="cursor:pointer" id="chooseBtn"
            src="/images/rightarrow_g.png" />
        <image style="cursor:pointer" id="removeBtn"
            src="/images/leftarrow_g.png" />
        <image style="cursor:pointer" id="removeAllBtn"
            src="/images/leftleftarrow_g.png" />
    </vbox>
    <listbox id="chosenLb" vflex="true" width="250px"
          model="${arg.chosenDataModel}" >
        <listhead>
            <listheader label="Selected Column List"></listheader>

        </listhead>
        <template name="model" var="each">
            <listitem>

                <listcell label="${each.value}" >
                <separator orient="vertical"  />

            <b >    <checkbox checked="${each.checked}" /></b>
                </listcell>
            </listitem>
        </template>
    </listbox>

    <vbox spacing="10px">
        <image style="cursor:pointer" id="topBtn"
            src="/images/upuparrow_g.png" />
        <image style="cursor:pointer" id="upBtn"
            src="/images/uparrow_g.png" />
        <image style="cursor:pointer" id="downBtn"
            src="/images/downarrow_g.png" />
        <image style="cursor:pointer" id="bottomBtn"
            src="/images/downdownarrow_g.png" />
    </vbox>

</hlayout>

我的问题是,当有人检查复选框时,我想调用一种方法来更新某些值。我该怎么做?

最佳答案

我使用此代码解决了上述问题..

<listbox id="chosenLb" vflex="1" width="100%"
                        height="135px" model="@load(vm.chosenDataModel)">
                        <listhead sizable="true">
                            <listheader>
                                <x:table width="100%">
                                    <x:tr>
                                        <x:td width="90%">
                                            <label
                                                value="Selected Column List" style="font-weight: bold">
                                            </label>
                                        </x:td>
                                        <x:td width="10%">
                                            <label
                                                value="Ascending" style="font-weight: bolder">
                                            </label>
                                        </x:td>
                                    </x:tr>
                                </x:table>
                            </listheader>

                        </listhead>

                        <template name="model" var="selected">
                            <listitem>
                                <listcell>
                                    <x:table width="100%">
                                        <x:tr>
                                            <x:td width="90%">
                                                <label
                                                    value="@bind(selected.listBoxHeaderName)"
                                                    style="width:200px">
                                                </label>
                                            </x:td>
                                            <x:td width="10%">

                                                <checkbox  
                                                    checked="@bind(selected.sortAscending)"
                                                    style="align:right;width:50px"
                                                     />
                                            </x:td>
                                        </x:tr>
                                    </x:table>
                                </listcell>
                            </listitem>
                        </template>
                    </listbox>

这是我的复选框

 <checkbox   checked="@bind(selected.sortAscending)" style="align:right;width:50px"/>

关于java - Zk 复选框有问题吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12369937/

相关文章:

java - zk - 是否可以为模型中的每条记录添加绑定(bind)?

java - 通过java IO创建一个新文件,当我将文件名设置为中文时,文件名变成 "?????"s

java - 循环双向链表 addToHead 并打印

java - 静默模式执行出现 "Job found still running after platform shutdown"错误

php - 在 PHP 中更新已经选中的复选框

ajax - org.zkoss.zk.device.DeviceNotFoundException : ajax not found

java - 由 : java. lang.ClassNotFoundException : org. openqa.selenium.browserlaunchers.DoNotUseProxyPac 引起

css - Google Chrome 中的单选按钮和复选框不稳定行为

JavaScript "If"关于复选框不起作用的声明

java - 任何 Jquery/AJAX 等工具都有 Chrome 之类的 SpellChecker 支持多语言