ICEfaces
  1. ICEfaces
  2. ICE-6679

ice:selectOneListbox displays the toString value instead of the specified item value

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.1
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      Tomcat 6.0.25, Liferay EE 6.0SP1, PortletFaces Bridge 2.0-beta4, LiferayFaces 6.0, AlloyFaces 1.0.1-BETA1
    • Workaround Exists:
      Yes
    • Workaround Description:
      Use <h:selectOneListbox> with icecore:singleSubmt tag.

      Description

      When using <ice:selectOneListbox> with Liferay, items are displayed as the toString value instead of the specified itemValue property of the nested <f:selectItem> components.

      This happens even even in very simple cases like this:

      <ui:composition xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:aui="http://portletfaces.org/alloyfaces/aui"
      xmlns:aui-cc="http://portletfaces.org/alloyfaces/aui-cc"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:ice="http://www.icesoft.com/icefaces/component"
      xmlns:icecore="http://www.icefaces.org/icefaces/core"
      xmlns:t="http://myfaces.apache.org/tomahawk"
      template="templates/main.xhtml">
      <ui:define name="body">
      <ice:form id="selectMediaForm" styleClass="aui-form dlp">
      <ice:selectOneListbox size="1" label="#{i18n['scope']}" partialSubmit="true"
      required="true"
      value="#{mutablePortletPreferencesValues['scopeGroupId'].value}">
      <f:selectItem itemLabel="#{i18n['select']}" itemValue="" />
      <f:selectItems itemValue="#{group.groupId}"
      itemLabel="#{group.name}" value="#{preferencesBackingBean.groups}"
      var="group" />
      </ice:selectOneListbox>
                     </ice:form>
      </ui:composition>

        Activity

        Hide
        Kito Mann added a comment -

        For a workaround, if you can use <h:selectOneListBox> with <f:ajax>:

        <h:selectOneListbox size="1" label="#

        {i18n['scope']}

        " required="true"
        value="#

        {mutablePortletPreferencesValues['scopeGroupId'].value}

        ">
        <f:selectItem itemLabel="#

        {i18n['select']}

        " itemValue="" />
        <f:selectItems itemValue="#

        {group.groupId}

        "
        itemLabel="#

        {group.name}

        " value="#

        {preferencesBackingBean.groups}

        "
        var="group" />
        <f:ajax execute="@this" render="docLibraryPanel" listener="#

        {preferencesBackingBean.savePreferences}

        "/>
        </h:selectOneListbox>

        Show
        Kito Mann added a comment - For a workaround, if you can use <h:selectOneListBox> with <f:ajax>: <h:selectOneListbox size="1" label="# {i18n['scope']} " required="true" value="# {mutablePortletPreferencesValues['scopeGroupId'].value} "> <f:selectItem itemLabel="# {i18n['select']} " itemValue="" /> <f:selectItems itemValue="# {group.groupId} " itemLabel="# {group.name} " value="# {preferencesBackingBean.groups} " var="group" /> <f:ajax execute="@this" render="docLibraryPanel" listener="# {preferencesBackingBean.savePreferences} "/> </h:selectOneListbox>
        Hide
        yip.ng added a comment - - edited

        What is the type of #

        {preferencesBackingBean.groups}

        ? If it's an array or a collection, then it seems to be working fine. Feature was implemented in ICE-6474 (Sun Jan 30 13:34:28 CST 2011).

        Tested with markups like these in compat showcase, changing the country list from SelectItem[] to Country[] or ArrayList<Country>:

        <f:selectItems id="SlctCntyItms" itemValue="#

        {country.id}" itemLabel="#{country.name}"
        value="#{selectionTags.countriesArray}" var="country"/>

        <f:selectItems id="SlctCntyItms" itemValue="#{country.id}

        " itemLabel="#

        {country.name}

        "
        value="#

        {selectionTags.countriesCollection}

        " var="country"/>

        See screenshot-01.png.

        Show
        yip.ng added a comment - - edited What is the type of # {preferencesBackingBean.groups} ? If it's an array or a collection, then it seems to be working fine. Feature was implemented in ICE-6474 (Sun Jan 30 13:34:28 CST 2011). Tested with markups like these in compat showcase, changing the country list from SelectItem[] to Country[] or ArrayList<Country>: <f:selectItems id="SlctCntyItms" itemValue="# {country.id}" itemLabel="#{country.name}" value="#{selectionTags.countriesArray}" var="country"/> <f:selectItems id="SlctCntyItms" itemValue="#{country.id} " itemLabel="# {country.name} " value="# {selectionTags.countriesCollection} " var="country"/> See screenshot-01.png.

          People

          • Assignee:
            yip.ng
            Reporter:
            Kito Mann
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: