-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I am trying to build a listbox with inline row editing. (http://www.zkoss.org/zkdemo/grid/inline_row_editing). the only difference with my code is:
>> I use a listbox due to i need to selected item property.
>> the control to edit a row it is a menupopup.
the main problem with my code is that when you click in one elemen of the listbox (left or right button) this section refresh and it is throw an eception. But when i remove one of the template section (<template name="model">) it is works fine. is this a bug in the listbox with multiple template? i checked in mutiple ways but i can not get the solution to the problem...
<menupopup id="editPopup"> <menuitem id="RenameBookmark" label="${labels.menupopup.bookmarkItem1}" image="/images/modify_icon.png" onClick="@command('changeEditableStatus')" ></menuitem> <menuitem id="DeleteBookmark" label="${labels.menupopup.bookmarkItem2}" image="/images/icon_remove.png" onClick="@command('deleteBookMark')"></menuitem> </menupopup> <listbox id="bookMark" model="@bind(vm.userBookMarkStatusVoList) @template(each.editingStatus? 'editable':'noneditable')" selectedItem="@bind(vm.selectedUserBookMarkStatusVo)"> <!-- BOOK MARK NON EDITABLE --> <template name="noneditable" var="tag" > <listitem droppable="nubblers" onDrop="@command('onDraggedNubblerToBookMark', onDropEvent=event, entry=tag)"> <listcell> <label hflex="1" value="@bind(tag.userBookMarkVo.name)" sclass="icon" tooltiptext="${labels.menupopup.bookmarkToolTip}" context="editPopup" ></label> </listcell> </listitem> </template> <template name="editable"> <listitem> <listcell> <textbox hflex="1" value="@bind(each.userBookMarkVo.name)" ></textbox> </listcell> </listitem> </template> </listbox>
10:03:42,437 GRAVE [org.zkoss] (http-myamp.dyndns.org-192.168.1.30-8080-5) >>org.zkoss.zk.ui.UiException: model of the databind listbox <Listbox tV5Q00#bookMark> must be an instanceof of org.zkoss.zkplus.databind.BindingListModel.[es.migou.myamp.fe.vo.UserBookMarkStatusVo@17e238e, es.migou.myamp.fe.vo.UserBookMarkStatusVo@5057fe, es.migou.myamp.fe.vo.UserBookMarkStatusVo@c0e5e1, es.migou.myamp.fe.vo.UserBookMarkStatusVo@344c81, es.migou.myamp.fe.vo.UserBookMarkStatusVo@18ad24a] >> at org.zkoss.zkplus.databind.SelectedItemConverter.coerceToUi(SelectedItemConverter.java:108) >> at org.zkoss.zkplus.databind.Binding.myLoadAttribute(Binding.java:383) >> at org.zkoss.zkplus.databind.Binding.loadAttribute(Binding.java:336) >> at org.zkoss.zkplus.databind.Binding$BaseLoadEventListener.handleEvent(Binding.java:633) >> at org.zkoss.zkplus.databind.Binding$LoadEventListener.onEvent(Binding.java:649) >> at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2732) >> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2681) >> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2644) >> at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) >> at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1710) >> at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1495) >> at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1205) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:583) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:481) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:489) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) >> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) >> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) >> at es.migou.myamp.fe.filters.SessionValidateFilter.doFilter(SessionValidateFilter.java:120) >> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) >> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) >> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) >> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) >> at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) >> at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) >> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) >> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) >> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) >> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) >> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) >> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) >> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) >> at java.lang.Thread.run(Unknown Source) /code]
template with name "model" is reserved for Collection component's MVC Automate Renderer Generating, ZK Dev Ref - Listbox Template
Speak simply, you cannot use the template with name "model" in a MVVM circumstance.
I don´t get you.... If you see the example, i not using the template name =model
<listbox id="bookMark" model="@bind(vm.userBookMarkStatusVoList) @template(each.editingStatus? 'editable':'noneditable')"
selectedItem="@bind(vm.selectedUserBookMarkStatusVo)">
<template name="noneditable">
<template name="editable">
IT is the same as http://www.zkoss.org/zkdemo/grid/inline_row_editing. The only thing is that i need a listbox to get the selectItem.....
Asked: 2012-12-18 01:07:27 +0800
Seen: 166 times
Last updated: Dec 30 '12