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

shadow components inside a Listbox' template cause an exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.5.2
    • 8.0.4.2
    • None
    • Security Level: Jimmy
    • None
    • None

      Steps to Reproduce

      1. uncomment the first listbox
      2. run the attached zul

      Current Result

      
      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.doInitRenderer(Listbox.java:2584)
      	at org.zkoss.zul.Listbox.onInitRender(Listbox.java:2537)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3144)
      	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3075)
      	at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1853)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1625)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:548)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:369)
      	at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:211)
      	at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:137)
      	
      

      Expected Result

      no exception.

      Debug Info

      • there are 2 comparison cases in the attached zul
        	<listbox width="400px" height="500px" model="@load(model)">
        		<listhead>
        			<listheader label="item" />
        		</listhead>
        		<template name="model">
        			<choose>
        				<when test="@init(each eq 'last')">
        					<listitem>
        						<listcell>
        							<button label="test" />
        						</listcell>
        					</listitem>
        				</when>
        				<otherwise>
        					<listitem>
        						<listcell label="@init(each)" />
        					</listitem>
        				</otherwise>
        			</choose>
        		</template>
        	</listbox>
        

      Workaround

      • use EL instead of data binding

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

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 day Original Estimate - 1 day
                1d
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 week, 3 days
                1w 3d