SelectManyMenu SelectManyMenu is used to choose multiple items from a list.
  • Option 1
  • Option 2
  • Option 3
Afterdark
Afternoon
Afterwork
Aristo
Black-Tie
Blitzer
Bluesky
Bootstrap
Casablanca
Cupertino
Cruze
Dark-Hive
Delta
Dot-Luv
Eggplant
Excite-Bike
Flick
Glass-X
Home
Hot-Sneaks
Humanity
Le-Frog
Midnight
Mint-Choc
Omega
Overcast
Pepper-Grinder
Redmond
Rocket
Sam
Smoothness
South-Street
Start
Sunny
Swanky-Purse
Trontastic
UI-Darkness
UI-Lightness
Vader

Selected Values
Basic:
No records found.
Advanced:
No records found.
<h:form>
    <h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5" columnClasses="label, value">
        <p:outputLabel for="basic" value="Basic:" />
        <p:selectManyMenu id="basic" value="#{selectManyView.selectedOptions}">
            <f:selectItem itemLabel="Option 1" itemValue="1" />
            <f:selectItem itemLabel="Option 2" itemValue="2" />
            <f:selectItem itemLabel="Option 3" itemValue="3" />
        </p:selectManyMenu>

        <p:outputLabel for="advanced" value="Advanced:" />
        <p:selectManyMenu id="advanced" value="#{selectManyView.selectedThemes}" converter="themeConverter" 
                          var="t" filter="true" filterMatchMode="contains" showCheckbox="true">
            <f:selectItems value="#{selectManyView.themes}" var="theme" itemLabel="#{theme.displayName}" itemValue="#{theme}" />

            <p:column>
                <h:outputText styleClass="ui-theme ui-theme-#{t.name}" />
            </p:column>

            <p:column>
                <h:outputText value="#{t.displayName}" />
            </p:column>
        </p:selectManyMenu>
    </h:panelGrid>

    <p:separator />

    <p:commandButton value="Submit" update="display" oncomplete="PF('dlg').show()" icon="ui-icon-check" />

    <p:dialog header="Selected Values" modal="true" showEffect="fade" widgetVar="dlg" resizable="false">
        <p:panelGrid columns="2" id="display" columnClasses="label,output">
            <h:outputText value="Basic:" />
            <p:dataList value="#{selectManyView.selectedOptions}" var="option">
                <h:outputText value="#{option}" />
            </p:dataList>

            <h:outputText value="Advanced:" />
            <p:dataList value="#{selectManyView.selectedThemes}" var="t">
                <h:outputText value="#{t}" />
            </p:dataList>
        </p:panelGrid>
    </p:dialog>
</h:form>
                
PrimeTek, Copyright © 2015
All rights reserved.
Running PrimeFaces-6.1-SNAPSHOT on Mojarra-2.2.8.