0

Wrong index on combobox onChange event

asked 2012-12-12 20:03:53 +0800

ajaidka gravatar image ajaidka
196 4

updated 2012-12-12 20:04:17 +0800

here is the example

http://zkfiddle.org/sample/1sed986/5-combobox-onChange-issue

there are 3 comboitems in combobox
index 0 "Apple"
index 1 "Apple"
index 2 "Apple 3G"

If you select 1 ZK is printing selected index 0, it is because 0th and 1th both have same label.

Any idea how to fix this?

Thanks
AJaidka

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2012-12-13 06:44:19 +0800

jj gravatar image jj
638 3

updated 2012-12-13 06:45:13 +0800

Listen to onSelect event also, since onChange only handles text change.

link publish delete flag offensive edit

answered 2012-12-14 04:02:44 +0800

ajaidka gravatar image ajaidka
196 4

onSelect is called even when user do scroll up/down, because it change the selection. This is not what I want.

I tried with selectedItem="@bind(vm.selctedItem)", this even binds with the wrong row in vm.

link publish delete flag offensive edit

answered 2012-12-14 09:23:33 +0800

vincentjian gravatar image vincentjian
2245 6

Hi, onChange event can only get the input text value and compare it with all comboitem to check if one of them matched.
Therefore we have no idea the input value should map to which comboitem. You should specify different value and label on comboitem.

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: 2012-12-12 20:03:53 +0800

Seen: 61 times

Last updated: Dec 14 '12

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