java - How to set a cell editable when row is selected in WLISTBOX ZK? -


i want make specific cell editable when row selected in wlistbox in zk framework?

because there no answer of wanted mvvm or mvc decided go mvvm.

here working fiddle.
i'm pasting important code here when link shouldn't work anymore :

<listbox model="@load(vm.items)" selecteditem="@bind(vm.selected)" hflex="true" height="300px">     <listhead>         <listheader label="name" width="80px"/>         <listheader label="price" align="center" width="80px" />         <listheader label="quantity" align="center" width="80px" />     </listhead>     <template name="model" var="item">         <listitem >             <listcell>                 <label visible="@load(vm.selected ne item)" value="@load(item.name)" />                 <textbox visible="@load(vm.selected eq item)" value="@bind(item.name)" />             </listcell>             <listcell>                 <label visible="@load(vm.selected ne item)" value="@load(item.price)" />                 <intbox visible="@load(vm.selected eq item)" readonly="true" value="@bind(item.price)" />             </listcell>             <listcell>                 <label visible="@load(vm.selected ne item)" value="@load(item.quantity)" />                 <intbox visible="@load(vm.selected eq item)" readonly="true" value="@bind(item.quantity)" />             </listcell>         </listitem>     </template> </listbox> 

little explication, if working previous zk 8 can use this.
check in zul if selected item equals (eq) or don't equals (ne) rendered item.
change visibility of component then.
if working zk8 or higher can use <if test="load(vm.selected eq item)">.
it's working shadow elements , condition isn't true not rendered(not in dom), while working visible in dom.

use if attribute in zk8 in combination ${} expressions, mvvm syntax won't work.
, because it's static can't use switch realtime.
that's reason why need use visible attribute.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -