Locale

Language
English
English
English
French
German
German
Italian
Korean
Spanish
Catalan
Dutch
Portuguese
Portuguese
Arabic
Arabic
Bulgarian
Czech
Greek
Persian
Finnish
Danish
Hindi
Indonesian
Croatian
Japanese
Hungarian
Hebrew
Georgian
Central Kurdish
Khmer
Kyrgyz
Kazakh
Lithuanian
Latvian
Malay
Norwegian
Polish
Romanian
Russian
Slovak
Slovenian
Serbian
Swedish
Thai
Turkish
Ukrainian
Vietnamese
Chinese
Chinese

Input Style

Free Themes

Built-in component themes created by the PrimeFaces Theme Designer.

Saga Saga
Vela Vela
Arya Arya

Legacy Free Themes

Luna Amber Luna Amber
Luna Blue Luna Blue
Luna Green Luna Green
Luna Pink Luna Pink
Nova Nova
Nova Nova Alt
Nova Nova Accent

DataTable Selection

There are various ways to select rows from the datatable.

Basic
CodeNameCategoryQuantity
f230fh0g3Bamboo WatchAccessories24
nvklal433Black WatchAccessories61
zz21cz3c1Blue BandFitness2
244wgerg2Blue T-ShirtClothing25
h456wer53BraceletAccessories73
av2231fwgBrown PurseAccessories0
bib36pfvmChakra BraceletAccessories5
mbvjkgip5Galaxy EarringsAccessories23
vbb124btrGame ControllerElectronics2
cm230f032Gaming SetElectronics63
Single with Row Click
CodeNameCategoryQuantity
f230fh0g3Bamboo WatchAccessories24
nvklal433Black WatchAccessories61
zz21cz3c1Blue BandFitness2
244wgerg2Blue T-ShirtClothing25
h456wer53BraceletAccessories73
av2231fwgBrown PurseAccessories0
bib36pfvmChakra BraceletAccessories5
mbvjkgip5Galaxy EarringsAccessories23
vbb124btrGame ControllerElectronics2
cm230f032Gaming SetElectronics63
Select Events
CodeNameCategoryQuantity
f230fh0g3Bamboo WatchAccessories24
nvklal433Black WatchAccessories61
zz21cz3c1Blue BandFitness2
244wgerg2Blue T-ShirtClothing25
h456wer53BraceletAccessories73
av2231fwgBrown PurseAccessories0
bib36pfvmChakra BraceletAccessories5
mbvjkgip5Galaxy EarringsAccessories23
vbb124btrGame ControllerElectronics2
cm230f032Gaming SetElectronics63
Multiple with Meta and Shift keys
CodeNameCategoryQuantity
f230fh0g3Bamboo WatchAccessories24
nvklal433Black WatchAccessories61
zz21cz3c1Blue BandFitness2
244wgerg2Blue T-ShirtClothing25
h456wer53BraceletAccessories73
av2231fwgBrown PurseAccessories0
bib36pfvmChakra BraceletAccessories5
mbvjkgip5Galaxy EarringsAccessories23
vbb124btrGame ControllerElectronics2
cm230f032Gaming SetElectronics63
RadioButton
CodeNameCategoryQuantity
f230fh0g3Bamboo WatchAccessories24
nvklal433Black WatchAccessories61
zz21cz3c1Blue BandFitness2
244wgerg2Blue T-ShirtClothing25
h456wer53BraceletAccessories73
av2231fwgBrown PurseAccessories0
bib36pfvmChakra BraceletAccessories5
mbvjkgip5Galaxy EarringsAccessories23
vbb124btrGame ControllerElectronics2
cm230f032Gaming SetElectronics63
Checkbox
CodeNameCategoryQuantity
f230fh0g3Bamboo WatchAccessories24
nvklal433Black WatchAccessories61
zz21cz3c1Blue BandFitness2
244wgerg2Blue T-ShirtClothing25
h456wer53BraceletAccessories73

<h:form id="form">
    <p:growl id="msgs" showDetail="true" skipDetailIfEqualsSummary="true"/>

    <div class="card">
        <h5>Basic</h5>
        <p:dataTable id="basicDT" var="product" value="#{dtSelectionView.products1}">
            <p:column headerText="Code">
                <h:outputText value="#{product.code}"/>
            </p:column>

            <p:column headerText="Name">
                <h:outputText value="#{product.name}"/>
            </p:column>

            <p:column headerText="Category">
                <h:outputText value="#{product.category}"/>
            </p:column>

            <p:column headerText="Quantity">
                <h:outputText value="#{product.quantity}"/>
            </p:column>

            <p:column style="width:3rem;text-align: center">
                <p:commandButton update=":form:productDetail" oncomplete="PF('productDialog').show()"
                                 icon="pi pi-search" title="View">
                    <f:setPropertyActionListener value="#{product}"
                                                 target="#{dtSelectionView.selectedProduct}"/>
                </p:commandButton>
            </p:column>
        </p:dataTable>
    </div>

    <div class="card">
        <h5>Single with Row Click</h5>
        <p:dataTable id="singleDT" var="product" value="#{dtSelectionView.products2}" selectionMode="single"
                     selection="#{dtSelectionView.selectedProduct}" rowKey="#{product.id}">
            <p:column headerText="Code">
                <h:outputText value="#{product.code}"/>
            </p:column>

            <p:column headerText="Name">
                <h:outputText value="#{product.name}"/>
            </p:column>

            <p:column headerText="Category">
                <h:outputText value="#{product.category}"/>
            </p:column>

            <p:column headerText="Quantity">
                <h:outputText value="#{product.quantity}"/>
            </p:column>
            <f:facet name="footer">
                <p:commandButton process="singleDT" update=":form:productDetail" icon="pi pi-search"
                                 value="View"
                                 oncomplete="PF('productDialog').show()"/>
            </f:facet>
        </p:dataTable>
    </div>

    <div class="card">
        <h5>Select Events</h5>
        <p:dataTable id="eventsDT" var="product" value="#{dtSelectionView.products3}" selectionMode="single"
                     selection="#{dtSelectionView.selectedProduct}" rowKey="#{product.id}">
            <p:ajax event="rowSelect" listener="#{dtSelectionView.onRowSelect}" update=":form:msgs"/>
            <p:ajax event="rowUnselect" listener="#{dtSelectionView.onRowUnselect}" update=":form:msgs"/>
            <p:column headerText="Code">
                <h:outputText value="#{product.code}"/>
            </p:column>

            <p:column headerText="Name">
                <h:outputText value="#{product.name}"/>
            </p:column>

            <p:column headerText="Category">
                <h:outputText value="#{product.category}"/>
            </p:column>

            <p:column headerText="Quantity">
                <h:outputText value="#{product.quantity}"/>
            </p:column>
        </p:dataTable>
    </div>

    <div class="card">
        <h5>Multiple with Meta and Shift keys</h5>
        <p:dataTable id="multipleDT" var="product" value="#{dtSelectionView.products4}" selectionMode="multiple"
                     selection="#{dtSelectionView.selectedProducts}" rowKey="#{product.id}">
            <p:column headerText="Code">
                <h:outputText value="#{product.code}"/>
            </p:column>

            <p:column headerText="Name">
                <h:outputText value="#{product.name}"/>
            </p:column>

            <p:column headerText="Category">
                <h:outputText value="#{product.category}"/>
            </p:column>

            <p:column headerText="Quantity">
                <h:outputText value="#{product.quantity}"/>
            </p:column>
        </p:dataTable>
    </div>

    <div class="card">
        <h5>RadioButton</h5>
        <p:dataTable id="radioDT" var="product" value="#{dtSelectionView.products5}"
                     selection="#{dtSelectionView.selectedProduct}" rowKey="#{product.id}">
            <p:column selectionBox="true" style="width:16px;text-align:center"/>
            <p:column headerText="Code">
                <h:outputText value="#{product.code}"/>
            </p:column>

            <p:column headerText="Name">
                <h:outputText value="#{product.name}"/>
            </p:column>

            <p:column headerText="Category">
                <h:outputText value="#{product.category}"/>
            </p:column>

            <p:column headerText="Quantity">
                <h:outputText value="#{product.quantity}"/>
            </p:column>
            <f:facet name="footer">
                <p:commandButton process="radioDT" update=":form:productDetail" icon="pi pi-search" value="View"
                                 oncomplete="PF('productDialog').show()"/>
            </f:facet>
        </p:dataTable>
    </div>

    <div class="card">
        <h5>Checkbox</h5>
        <p:dataTable id="checkboxDT" var="product" value="#{dtSelectionView.products6}"
                     selection="#{dtSelectionView.selectedProducts}" rowKey="#{product.id}"
                     style="margin-bottom:0" paginator="true" rows="5" selectionPageOnly="true"
                     selectionRowMode="add">
            <p:column selectionBox="true" style="width:16px;text-align:center"/>
            <p:column headerText="Code">
                <h:outputText value="#{product.code}"/>
            </p:column>

            <p:column headerText="Name">
                <h:outputText value="#{product.name}"/>
            </p:column>

            <p:column headerText="Category">
                <h:outputText value="#{product.category}"/>
            </p:column>

            <p:column headerText="Quantity">
                <h:outputText value="#{product.quantity}"/>
            </p:column>
        </p:dataTable>
    </div>

    <p:dialog header="Product Info" widgetVar="productDialog" modal="true" showEffect="fade"
              hideEffect="fade" resizable="false">
        <p:outputPanel id="productDetail" style="text-align:center;">
            <p:column rendered="#{not empty dtSelectionView.selectedProduct}">
                <div class="product">
                    <div class="product-grid-item card" style="margin-bottom: 0">
                        <div class="product-grid-item-top">
                            <div>
                                <i class="pi pi-tag product-category-icon"/>
                                <span class="product-category">#{dtSelectionView.selectedProduct.category}</span>
                            </div>
                            <span class="product-badge status-#{dtSelectionView.selectedProduct.inventoryStatus.statusName}">#{dtSelectionView.selectedProduct.inventoryStatus.text}</span>
                        </div>
                        <div class="product-grid-item-content">
                            <p:graphicImage
                                    name="demo/images/product/#{dtSelectionView.selectedProduct.image}"/>
                            <div class="product-name">#{dtSelectionView.selectedProduct.name}</div>
                            <div class="product-description">#{dtSelectionView.selectedProduct.description}</div>
                            <p:rating readonly="true" value="#{dtSelectionView.selectedProduct.rating}"/>
                        </div>
                        <div class="product-grid-item-bottom">
                            <h:outputText value="#{dtSelectionView.selectedProduct.price}"
                                          styleClass="product-price">
                                <f:convertNumber currencySymbol="$" type="currency"/>
                            </h:outputText>
                            <p:commandButton value="Add To Cart" icon="pi pi-shopping-cart"
                                             disabled="#{dtSelectionView.selectedProduct.inventoryStatus == 'OUTOFSTOCK'}">
                                <f:setPropertyActionListener value="#{dtSelectionView.selectedProduct}"
                                                             target="#{dtSelectionView.selectedProduct}"/>
                            </p:commandButton>
                        </div>
                    </div>
                </div>
            </p:column>
        </p:outputPanel>
    </p:dialog>
</h:form>