ZK:仅为列表框的选定项目启用列表单元格中的按钮



在下一个列表框中,我用模板加载元素:

<listbox model="@load(vm.resAccepted)" selectedItem="@bind(vm.selResAccepted)">
  <template name="model">
    <listitem>
      <listcell label="@load(each.eventName)" />
      <listcell label="@load(each.userName)" />
      <listcell>
        <button image="/img/button_mail.png"/>
      </listcell>
    </listitem>
  </template>
</listbox>

我的目标是为用户选择的行启用列表项ONLY的按钮。

为此,我尝试

<button disabled="@load(vm.selResAccepted.id=each.id?'false':'true')" />

检查唯一字段id是否与所选元素相同,但失败。

任何帮助都将不胜感激。

您可以使用eq进行相等比较:

<button disabled="@load(vm.selResAccepted.id eq each.id?'false':'true')" />

或者可能更好:当选择的项目不是当前项目时禁用

<button disabled="@load(vm.selResAccepted ne each)" />

此处ne不等于

最新更新