Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.6
-
Component/s: ICE-Components
-
Labels:None
-
Environment:any
-
ICEsoft Forum Reference:
Description
users want to be able to show different entries with the same label in a selectInputText component, i.e. one would desire to show the following:
City | State | Country
Springfield | IL | USA
Springfield | MA |USA
trying this with the current release 1.6.0 results always in the last element to be selected in the backing bean code, because
the values of this component are stored within a map and the map's key is the SelectItems label. When there are more labels
with equal values only the last one will be stored in this map.
City | State | Country
Springfield | IL | USA
Springfield | MA |USA
trying this with the current release 1.6.0 results always in the last element to be selected in the backing bean code, because
the values of this component are stored within a map and the map's key is the SelectItems label. When there are more labels
with equal values only the last one will be stored in this map.
The SelectInputText component no longer keeps a Map of String labels to SelectItem objects. As well, when a list selection is made by the user, the list index is transmitted from the browser, and not just the label. This way, in the textChangeListener and valueChangeListener, SelectInputText.getSelectedItem() can be called, to get the exact selected item, regardless of whether there are entries with duplicated labels.
The caveat being that, with state saving, the value field of the SelectItem objects needs to be Serializable, or else the selectedItem won't be saved, and it should implement equals(), to be comparable, when de-Serialized to the original SelectItem. Regardless if the selectedItem is state saved, it will at least be valid through the textChangeListener and valueChangeListener invocations, in the lifecycle when the user has selected an entry from the list.
Because components always resubmit their values for every form submit, including partialSubmits, the SelectInputText component will decode the submitted label each lifecycle, but only decodes the list index selections from user interactions. So, the selectedItem can be lost over subsequent form submits. If there is exactly one matching SelectItem label, the selectedItem will be set to it. But, it will not match if there are duplicate labels, like it used to.
Subversion 17900
icefaces\bridge\lib\extras\autocomplete_ext.js
icefaces\component\src\com\icesoft\faces\component\selectinputtext\SelectInputText.java
icefaces\component\src\com\icesoft\faces\component\selectinputtext\SelectInputTextRenderer.java
icefaces\samples\component-showcase\common-src\org\icefaces\application\showcase\view\bean\examples\component\selectInputText\CityDictionary.java
Subversion 17905
icefaces\application\showcase\view\bean\examples\component\selectInputText\SelectInputTextController.java