-
Bug
-
Resolution: Fixed
-
Normal
-
8.0.4.2
-
None
-
Security Level: Jimmy
-
None
Steps to Reproduce
- uncomment the first listbox
- 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