-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Following ZUL file:
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="./win"?> <?page title="Combobox, Model, Selected Item" contentType="text/html;charset=UTF-8"?> <window id="win" title="Listbox sort of generic entries" border="normal"> <zscript><![CDATA[ String[] model1 = new String[] { "A", "B" }; String[] model2 = new String[] { "C", "D" }; String[] model = model1; String selectedItem = null; ]]></zscript> <combobox id="cb" model="@{model, load-after='btChange.onClick'}" selectedItem="@{selectedItem}" readonly="true"/> <button id="btChange" label="Switch Model" onClick="model = model == model1 ? model2 : model1;"/> <button id="btShow" label="Show Selected Item"/> <label value="@{selectedItem, load-after='btShow.onClick'}"/> </window>
Perform the following steps:
1. Select an item from the combobox
the data-bound selected item string is correctly updated, as it can be seen in the label on the right
2. Click on switch model
the model in the combobox is replaced, but it does not affect the data-bound selectedItem, even if it is not member of the second array.
Question before I pass this to bugs:
Shouldn't the combobox create an artificial event, to make sure to update the corresponding selectedItem data model?
Asked: 2011-02-09 08:02:03 +0800
Seen: 720 times
Last updated: Feb 11 '11