-
Bug
-
Resolution: Fixed
-
Normal
-
6.5.4
-
Windows 7, JDK 7, Tomcat 7
-
None
When a combobox loses focus and a typed value matches an item case insensitively, bound selectedItem is not updated.
In the following example if "se" is typed in the combobox and focus is set to the textbox, "SE" (Sverige) is selected, but the label is not updated accordingly.
Setting the focus back to the combobox and then to the textbox, causes the label to be updated.
While the widget selects the item matching the label case insensitively, the component (Combobox#syncValueToSelection) does it case sensitively.
If strict constraint is not set, even the the component should match the label case insensitively.
<zk> <hbox apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('TestVM')"> <combobox model="@init(vm.countries)" selectedItem="@bind(vm.country)" autodrop="true" autocomplete="true" > <template name="model"> <comboitem value="each" label="${each.code}" description="${each.name}" /> </template> </combobox> <cell width="8em" valign="middle"> <label value="@load(vm.country.name)" /> </cell> <textbox /> </hbox> </zk>
public class TestVM { public class Country { private String code; private String name; public Country(String code, String name) { this.code = code; this.name = name; } public String getCode() { return code; } public String getName() { return name; } public void setCode(String code) { this.code = code; } public void setName(String name) { this.name = name; } } private List<Country> countries; private Country country; public List<Country> getCountries() { return countries; } public Country getCountry() { return country; } @Init public void init() { countries = Arrays.asList(new Country[] { // new Country("AT", "\u00D6sterreich"), // new Country("BE", "Belgi\u00EB"), // new Country("BG", "\u0411\u044A\u043B\u0433\u0430\u0440\u0438\u044F"), // new Country("CH", "Suisse"), // new Country("CY", "\u039A\u03CD\u03C0\u03C1\u03BF\u03C2"), // new Country("CZ", "\u010Cesk\u00E1 republika"), // new Country("DE", "Deutschland"), // new Country("DK", "Danmark"), // new Country("EE", "Eesti"), // new Country("ES", "Espa\u00F1a"), // new Country("FI", "Suomi"), // new Country("FR", "France"), // new Country("GB", "United Kingdom"), // new Country("GR", "\u0395\u03BB\u03BB\u03AC\u03B4\u03B1"), // new Country("HU", "Magyarorsz\u00E1g"), // new Country("IE", "\u00C9ire"), // new Country("IS", "\u00CDsland"), // new Country("IT", "Italia"), // new Country("LT", "Lietuva"), // new Country("LU", "L\u00EBtzebuerg"), // new Country("LV", "Latvija"), // new Country("MT", "Malta"), // new Country("NL", "Nederland"), // new Country("NO", "Norge"), // new Country("PL", "Polska"), // new Country("PT", "Portugal"), // new Country("RO", "Rom\u00E2nia"), // new Country("SE", "Sverige"), // new Country("SI", "Slovenija"), // new Country("SK", "Sloensk\u00E1 republika") // }); } public void setCountry(Country country) { this.country = country; } }