Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4139

using "if" inside a Listbox' template cause an exception

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • Normal
    • None
    • 8.6.0
    • None
    • Security Level: Jimmy
    • None

    Description

      Steps to Reproduce

      1. run the zul below

          <zscript><![CDATA[
      ListModelList model = new ListModelList();
      model.add("item1");
      model.add("item2");
      model.add("item3");
      model.add("best");
      ]]></zscript>
      
          <listbox apply="org.zkoss.bind.BindComposer" width="300px" height="600px" model="@load(model)">
              <listhead>
                  <listheader label="item"/>
              </listhead>
              <template name="model">
                  <if test="@load(each eq 'best')">
                      <listitem>
                          <listcell>
                              <button label="test"/>
                          </listcell>
                      </listitem>
                  </if>
              </template>
          </listbox>
      

      Current Result

      SEVERE:
      org.zkoss.zk.ui.UiException: The model template must have exactly one item, not 0
      at org.zkoss.bind.impl.BindListitemRenderer.render(BindListitemRenderer.java:94)
      at org.zkoss.zul.Listbox$Renderer.render(Listbox.java:2769)
      at org.zkoss.zul.Listbox.renderItems(Listbox.java:2891)
      at org.zkoss.zul.Listbox.service(Listbox.java:3731)
      at org.zkoss.zk.ui.impl.DesktopImpl.service(DesktopImpl.java:784)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1310)
      at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:611)

      Expected Result

      one item rendered

      debug info

      this bug has a similar problem with ZK-3630

      Attachments

        Issue Links

          Activity

            People

              rudyhuang rudyhuang
              hawk hawk
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 4 hours
                  4h
                  Remaining:
                  Time Spent - 2 hours Remaining Estimate - 2 hours
                  2h
                  Logged:
                  Time Spent - 2 hours Remaining Estimate - 2 hours
                  2h