ICEfaces
  1. ICEfaces
  2. ICE-1993

selectInputText: allow different entries with the same label

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: 1.7.2-SP2, 1.8
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      any

      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.

        Issue Links

          Activity

          Hide
          Mark Collette added a comment -

          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

          Show
          Mark Collette added a comment - 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
          Hide
          Ken Fyten added a comment -

          Backport to icefaces-1.7 branch.

          Show
          Ken Fyten added a comment - Backport to icefaces-1.7 branch.
          Hide
          Mark Collette added a comment -

          Backported to ICEfaces 1.7 branch
          Subversion 18668

          Show
          Mark Collette added a comment - Backported to ICEfaces 1.7 branch Subversion 18668
          Hide
          Joanne Bai added a comment -

          verified with success on 1.7.2-SP2 build3 (tested on tomcat6 + FF2 and IE6)

          Show
          Joanne Bai added a comment - verified with success on 1.7.2-SP2 build3 (tested on tomcat6 + FF2 and IE6)

            People

            • Assignee:
              Unassigned
              Reporter:
              Michael Thiem
            • Votes:
              5 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: