Create new RichFaces Documentation Jira issue

This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.orgCommunity Documentation

6.12.3.  < rich:pickList > available since 3.2.0

The <rich:pickList> component is used for moving selected item(s) from one list into another.


The <rich:pickList> component consists of

The "value" attribute is the initial value of this component.

The <f:selectItem /> or <f:selectItems /> facets are used to define the values of a source list.

Example:


...
<rich:pickList value="#{pickBean.listValues}">
        <f:selectItem itemValue="Bentley" itemLabel="Bentley"/>
        <f:selectItem itemValue="Audi" itemLabel="Audi"/>
        <f:selectItems value="#{pickBean.sourceList}"/>
</rich:pickList>
...

The "switchByClick" attribute provides an option to copy and remove items between lists by one click. Default value of this attribute is "false", so you need a double click to copy, remove items from one list to another.

Lables of the move controls can be defined with "copyAllControlLabel" , "copyControlLabel" , "removeControlLabel" , "removeAllControlLabel" attributes.

Example:


...
<rich:pickList copyAllControlLabel = "#{pickBean.copyAllLabel}" copyControlLabel = "#{pickBean.copyLabel}" 
                    removeControlLabel = "#{pickBean.removeLabel}" removeAllControlLabel ="#{pickBean.removeAllLabel}" value="#{pickBean.listValues}">
        <f:selectItem itemValue="Bentley" itemLabel="Bentley"/>
        <f:selectItem itemValue="Audi" itemLabel="Audi"/>
        <f:selectItems value="#{pickBean.sourceList}"/>
</rich:pickList>
...

If you don't want to display labels on the buttons you need to set "showButtonsLabel" to "false".


Alternative to the given attributes are the following facets: "copyAllControl" , "removeAllControl" , "copyControl" , "removeControl" , "copyAllControlDisabled" , "removeAllControlDisabled" , "copyControlDisabled" , "removeControlDisabled" , "caption" .

It is an example of usage of the facets and it is identical to the previous example.


...
<rich:pickList value="#{pickBean.listValues}">
    <f:facet name="copyAllControl">
        <h:commandButton value="#{pickBean.copyAllLabel}" />
    </f:facet>
    <f:facet name="copyControl">
        <h:commandButton value="#{pickBean.copyLabel}" />
    </f:facet>
    <f:facet name="removeControl">
        <h:commandButton value="#{pickBean.removeLabel}" />
    </f:facet>
    <f:facet name="removeAllControl">
        <h:commandButton value="#{pickBean.removeAllLabel}" />
    </f:facet>
    <f:selectItem itemValue="Bentley" itemLabel="Bentley"/>
    <f:selectItem itemValue="Audi" itemLabel="Audi"/>
    <f:selectItems value="#{pickBean.sourceList}"/>
</rich:pickList>
...

With the help of "moveControlsVerticalAlign" attribute you can align move controls vertically.

The possible value for "moveControlsVerticalAlign" are "top", "bottom" and "center" (default value).

The <rich:pickList> component provides resizing of lists by using such attributes as:

  • "listsHeight" defines height of the lists.

  • "sourceListWidth" defines width of a source list.

  • "targetListWidth" defines width of a target list.

Example:


...
<rich:pickList listsHeight="#{pickBean.listsHeight}" sourceListWidth="#{pickBean.sourceListWidth}" targetListWidth="#{pickBean.targetListWidth}" value="#{pickBean.listValues}">
        <f:selectItem itemValue="Bentley" itemLabel="Bentley"/>
        <f:selectItem itemValue="Audi" itemLabel="Audi"/>
        <f:selectItems value="#{pickBean.sourceList}"/>
</rich:pickList>
...

The <rich:pickList> component allows to use internationalization method to redefine and localize the labels. You could use application resource bundle and define RICH_PICK_LIST_COPY_ALL_LABEL, RICH_PICK_LIST_COPY_LABEL, RICH_PICK_LIST_REMOVE_ALL_LABEL, RICH_PICK_LIST_REMOVE_LABEL there.


Table of <rich:pickList> attributes.










You can find all necessary information about style classes redefinition in
Definition of Custom Style Classes section.

On RichFaces LiveDemo page you can see an example of <rich:pickList> usage and sources for the given example.