0

Combobox model change does not affect data-bound selected item

asked 2011-02-09 08:02:03 +0800

Matze2 gravatar image Matze2
773 7

updated 2011-02-09 08:10:10 +0800

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?

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2011-02-10 21:29:55 +0800

PeterKuo gravatar image PeterKuo
481 2

I think the spec forget to consider such scenario.
You may post a bug, and let us track from there.
Thank you.

link publish delete flag offensive edit

answered 2011-02-11 06:31:59 +0800

Matze2 gravatar image Matze2
773 7

updated 2011-02-11 07:00:18 +0800

Hi Peter and all,

please find the issue here

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-02-09 08:02:03 +0800

Seen: 720 times

Last updated: Feb 11 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More