-
Bug
-
Resolution: Fixed
-
Normal
-
6.0.0
-
None
-
None
We use $MODLE$[index] to evaluate each item. And we always use $MODEL$ to store the model collection instance. The model name is thus polluted and item under the childBinding will always evaluate to the model collection specified in childBinding.
test case
---------------
<window apply="org.zkoss.bind.BindComposer" viewModel="@id('vm')
@init('org.zkoss.zktest.bind.issue.ChildBindingUnderListbox')">
<listbox id="outerbox" width="700px" model="@bind(vm.items)" rows="5">
<listhead>
<listheader label="index"/>
<listheader label="name"/>
</listhead>
<template name="model" var="item" status="s">
<listitem children="@bind(vm.dummyList(1)) @template('read')">
<template name="read">
<listcell label="@bind(s.index)"/>
<listcell label="@bind(item.name)"/>
</template>
</listitem>
</template>
</listbox>
</window>
--------
public class ChildBindingUnderListbox {
private List<Item> items;
public ChildBindingUnderListbox()
{ items = new ArrayList<Item>(); items.add(new Item("A")); items.add(new Item("B")); items.add(new Item("C")); items.add(new Item("D")); }public List<?> dummyList(int size)
{ return Arrays.asList(new Object[size]); }public List<Item> getItems()
{ return items; } static public class Item {
String name;
public Item(String name)
{ this.name = name; }public String getName() { return name; }
public void setName(String name) { this.name = name; }
}
}