-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello, I want to combine template/model in conjunction with new ZK6 bind mechanism (for handle dynamic data) and the legacy forEach (see first window below).
Unfortunately I can not access to "each" in the inner loop. "each" still refers to the outer "each".
If I use forEach in both loops (see second window), everything works as expected. Nested template/model loop works too, but I would not nested listboxes.
Is there a way to correct access to "each"?
Kai
<?xml version="1.0" encoding="UTF-8"?> <zk> <zscript><![CDATA[ ListModel lm= new ListModelList(); Object[] data= new Object[2]; data[0]= "Today"; data[1]= new String[] { "RE: Bandbox Autocomplete Problem", "RE: It's not possible to navigate a listbox' ite", "RE: FileUpload" }; lm.add(data); data= new Object[2]; data[0]= "Yesterday"; data[1]= new String[] { "RE: Opening more than one new browser window", "RE: SelectedItemConverter Question" }; lm.add(data); data= new Object[2]; data[0]= "Last Week"; data[1]= new String[] { "RE: Times_Series Chart help", "RE: SelectedItemConverter Question" }; lm.add(data); class VM { public ListModel getListModel() { return lm; } } ]]></zscript> <window id="win" title="Window ZK6 bind and inner forEach" border="normal" width="600px" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('VM')" > <listbox model="@bind(vm.listModel)"> <template name="model"> <listitem> <listcell label="@load(each[0])"/> <listcell> <vlayout> <zk forEach="${each[1]}"> <label value="${each}"/> </zk> </vlayout> </listcell> </listitem> </template> </listbox> </window> <window id="win_2" title="old Style forEach" border="normal" width="600px"> <listbox forEach="${lm}"> <listitem> <listcell label="${each[0]}"/> <listcell> <vlayout> <zk forEach="${each[1]}"> <label value="${each}"/> </zk> </vlayout> </listcell> </listitem> </listbox> </window> </zk>
Hi,
It does not work in 6.0.0 but works fine with latest freshly, not sure how about with ZK 6.0.1.
Regards,
Ben
Asked: 2012-05-23 13:17:35 +0800
Seen: 266 times
Last updated: May 30 '12