1 Reply Latest reply on Aug 28, 2012 7:08 PM by langer123

    rich:pickList losing its sort order after add/remove operations

    langer123

      I'm using Richfaces 4.2.2 with JSF2 and have the following picklist code:

       

       

      <rich:pickList id="internationalTransactionCountriesPicklist"
          value="#{currentRuleItem.ruleControls.GeographicControl.selectedValues}"
          sourceCaption="#{msg.AvailableCountries}"
          targetCaption="#{msg.SelectedCountries}"
          addText="#{msg.picklistSelectItemButtonLabel}"
          addAllText="#{msg.picklistSelectAllItemButtonLabel}"
          removeText="#{msg.picklistDeselectItemButtonLabel}"
          removeAllText="#{msg.picklistDeselectAllItemButtonLabel}"
          listHeight="150px"
          disabled="#{userSettings.userIsReadOnly}"
          readonly="#{userSettings.userIsReadOnly}">
          <f:ajax event="additems" render="@this"  execute="@this" />
          <f:ajax event="removeitems" render="@this" execute="@this" />
          <f:selectItems value="#{controls.fullCountryList}" 
              var="country" itemValue="#{country.countryCode}"
              itemLabel="#{country.displayName}" itemLabelEscaped="true" />                   
      </rich:pickList>
      

       

       

      controls.fullCountryList is a list of custom country objects.The custom country class implements the Comparable Interface.

       

      A problem occurs when I add an item from the source list to the target list and then remove this item from the target list.

       

      When it is added back to the source list it get's put down the bottom of the source list (Not sorted in the source list alphabetically as it originally was).

      Does anyone know of any ways around this?

       

      There is a bug open against it for RF3 here

       

      Thanks