-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
Hi,
Beginner in zk, I'm facing an issue I can't solve. In MVVM, I have a ListBox and I'd like to refresh an Include using the selected item of my ListBox as parameter. To achieve this, I bind the selectedItem property of the ListBox with my ViewModel and I add an invalidate of my include on the onSelect property. The issue is that when I'm selecting an Item, the include is refreshed but with the previously selected Item. I assume that the onSelect event is fired before the binding of the selectedItem property.
Any clue to solve that problem? Thank you very much.
PS: If the invalidate is fired from the onClick event of the listcell, it works fine, but we lose the ability to select an item with the keyboard.
Here is the zul:
<hbox apply="org.zkoss.bind.BindComposer"
viewModel="@id('pa') @init('ulis.zk.wizard.webapp.viewmodel.ParamsViewModel')" hflex="1">
<vbox hflex="1">
<button label="+" onClick="@command('addParam')" />
<listbox model="@load(pa.params)" selectedItem="@bind(pa.selectedParam)" onSelect="paramsInclude.invalidate()">
<template name="model" var="item">
<listitem draggable="true" droppable="true">
<listcell>
<label value="@load(item.clazz.simpleName)"/>
</listcell>
</listitem>
</template>
</listbox>
</vbox>
<include id="paramsInclude" hflex="4" type="@ref(pa.selectedParam.type)" bean="@ref(pa.selectedParam.clazz)" src="@load('/beanView.zul')"/>
</hbox>
2 | No.2 Revision |
Hi,
Beginner in zk, I'm facing an issue I can't solve. In MVVM, I have a ListBox and I'd like to refresh an Include using the selected item of my ListBox as parameter. To achieve this, I bind the selectedItem property of the ListBox with my ViewModel and I add an invalidate of my include on the onSelect property. The issue is that when I'm selecting an Item, the include is refreshed but with the previously selected Item. I assume that the onSelect event is fired before the binding of the selectedItem property.
Any clue to solve that problem? Thank you very much.
PS: If the invalidate is fired from the onClick event of the listcell, it works fine, but we lose the ability to select an item with the keyboard.
Here is the zul:
<hbox apply="org.zkoss.bind.BindComposer"
viewModel="@id('pa') @init('ulis.zk.wizard.webapp.viewmodel.ParamsViewModel')" hflex="1">
<vbox hflex="1">
<button label="+" onClick="@command('addParam')" />
<listbox model="@load(pa.params)" selectedItem="@bind(pa.selectedParam)" onSelect="paramsInclude.invalidate()">
<template name="model" var="item">
<listitem draggable="true" droppable="true">
<listcell>
<label value="@load(item.clazz.simpleName)"/>
</listcell>
</listitem>
</template>
</listbox>
</vbox>
<include id="paramsInclude" hflex="4" type="@ref(pa.selectedParam.type)" bean="@ref(pa.selectedParam.clazz)" src="@load('/beanView.zul')"/>
src="@load('/beanView.zul')"/></hbox>
</hbox>