I’m using data binding and trying to implement editable table (listbox) in ZK.
<listbox model="@bind(vm.beanList)" selectedItem="@bind(vm.selectedBean)"
mold="paging" pageSize="5">
<listhead>
<!-- ... -->
</listhead>
<template name="model">
<listitem>
<listcell>
<!-- ... -->
</listcell/>
<listcell>
<combobox width="100%" inplace="true"
model="@load(vm.otherBeanList)"
value="@load(each.property) @converter(vm.propertyConverter)"
itemRenderer="@load(vm.propertyComboItemRenderer)"
onSelect="@command('propertySelected')"
onFocus="@command('cellEditorSelected', item=self)"/>
</listcell>
</listitem>
</template>
</listbox>
One of the table column is combobox. User can click on it and change selected value from drop down list. Since all comboboxes use one model… and model implements Selectable interface user change selected value in each combobox in all rows directly.
So I need provide each combobox with separate model somehow… Or clone model somehow… Or completely change the way.
Any advise would be helpful and valueable.
Thanx.
The problem was solved by using List as model – not AbstractListModel.
ZK wraps collection with model and implicitly creates new ListModelList for each combobox. So every combobox uses its own model and has its own selection value.