Locale

Language
English
English
English
French
German
German
German
Italian
Korean
Spanish
Catalan
Dutch
Portuguese
Portuguese
Arabic
Arabic
Bulgarian
Bangla
Bosnian
Czech
Greek
Estonian
Persian
Finnish
Danish
Hindi
Indonesian
Icelandic
Croatian
Japanese
Hungarian
Hebrew
Georgian
Central Kurdish
Khmer
Kyrgyz
Kazakh
Lithuanian
Latvian
Malay
Norwegian
Polish
Romanian
Russian
Slovak
Slovenian
Serbian
Serbian
Swedish
Thai
Turkish
Ukrainian
Uzbek
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 Filter

Filtering updates the data based on the constraints.

Column Filtering
List of Customers
NameCountryRepresentative
Join Date
Status
Activity
Julie Stenseth IndiaOnyama Limba2025-03-14 UNQUALIFIED
Adams Morasca FranceIvan Magalhaes2025-03-07 RENEWAL
David Darakjy IndiaIoni Bowcher2025-03-24 UNQUALIFIED
Rodrigues Campain CanadaAnna Fali2025-03-07 QUALIFIED
Kadeem Flosi CanadaElwin Sharvill2025-03-05 RENEWAL
Morrow Ruta RussiaAmy Elsner2025-03-15 RENEWAL
Aruna Figeroa BrazilStephen Shaw2025-03-30 RENEWAL
Costa Dilliard United KingdomAmy Elsner2025-04-01 NEW
Ricardo Gaucho SpainAnna Fali2025-03-22 NEW
Antonio Caudy FranceStephen Shaw2025-03-23 UNQUALIFIED
Default Filter
List of Customers
NameCountryRepresentative
Join Date
Status
Activity
Silvio Slusarski GermanyAnna Fali2025-03-14 NEW
Sinclair Waycott SpainElwin Sharvill2025-03-10 NEW
Francesco Shinko BrazilIoni Bowcher2025-03-28 NEW
Global Filter Function
NameCountryRepresentativeDateStatusActivity
Aditya Kusko SpainElwin Sharvill2025-03-30 QUALIFIED
Kaitlin Ostrosky United KingdomAsiya Javayant2025-04-01 NEW
Julie Stenseth BrazilElwin Sharvill2025-03-28 QUALIFIED
Juan Wieser ArgentinaAmy Elsner2025-03-08 RENEWAL
Costa Dilliard RussiaAsiya Javayant2025-04-01 PROPOSAL
Sinclair Waycott JapanXuxue Feng2025-04-02 NEGOTIATION
Smith Glick CanadaElwin Sharvill2025-03-29 RENEWAL
Salvatore Stockham GermanyIoni Bowcher2025-03-11 PROPOSAL
Greenwood Bolognia RussiaOnyama Limba2025-03-25 NEW
Izzy Garufi RussiaStephen Shaw2025-03-26 NEW
Filter toggling

1. Hide filter components initially by adding ui-filter-togglable as styleClass to the datatable.
2. To show/hide the filter components call PF('customersTable4').toggleFilter().

List of Customers
Switch toggle with manual toggleFilter()
NameCountryRepresentative
Join Date
Status
Activity
Julie Stenseth IndiaOnyama Limba2025-03-14 UNQUALIFIED
Adams Morasca FranceIvan Magalhaes2025-03-07 RENEWAL
David Darakjy IndiaIoni Bowcher2025-03-24 UNQUALIFIED
Rodrigues Campain CanadaAnna Fali2025-03-07 QUALIFIED
Kadeem Flosi CanadaElwin Sharvill2025-03-05 RENEWAL
Morrow Ruta RussiaAmy Elsner2025-03-15 RENEWAL
Aruna Figeroa BrazilStephen Shaw2025-03-30 RENEWAL
Costa Dilliard United KingdomAmy Elsner2025-04-01 NEW
Ricardo Gaucho SpainAnna Fali2025-03-22 NEW
Antonio Caudy FranceStephen Shaw2025-03-23 UNQUALIFIED

<style>
    .ui-filter-column .ui-column-customfilter .custom-filter {
        width: 100%;
        box-sizing: border-box;
    }
</style>

<div class="card">
    <h5>Column Filtering</h5>
    <h:form>
        <p:dataTable var="customer" value="#{dtFilterView.customers1}" widgetVar="customersTable"
                     emptyMessage="No customers found with given criteria"
                     filteredValue="#{dtFilterView.filteredCustomers1}"
                     globalFilterOnly="#{dtFilterView.globalFilterOnly}">

            <f:facet name="header">
                <div class="flex align-items-center justify-content-between">
                    <span>List of Customers</span>
                    <div>
                        <p:inputText id="globalFilter"
                                     onkeyup="PrimeFaces.debounce(() => PF('customersTable').filter())"
                                     style="width:10rem"
                                     placeholder="Enter keyword"/>
                        <p:commandButton value="Global Filter Only" update="@form" styleClass="ml-2"
                                         action="#{dtFilterView.toggleGlobalFilter()}"/>
                    </div>
                </div>

            </f:facet>

            <p:column headerText="Name" filterBy="#{customer.name}" sortable="false"
                      filterMatchMode="contains" filterPlaceholder="Filter By Name">
                <h:outputText value="#{customer.name}"/>
            </p:column>

            <p:column headerText="Country" sortable="false"
                      filterBy="#{customer.country.name}">
                <span class="flag flag-#{customer.country.code}" style="width: 30px; height: 20px"/>
                <h:outputText style="vertical-align: middle; margin-left: .5rem"
                              value="#{customer.country.name}"/>
            </p:column>

            <p:column field="representative" headerText="Representative" filterMatchMode="exact"
                      sortable="false">
                <f:facet name="filter">
                    <p:selectOneMenu onchange="PF('customersTable').filter()" styleClass="ui-custom-filter">
                        <f:selectItem itemLabel="All" itemValue="#{null}" noSelectionOption="true"/>
                        <f:selectItems value="#{dtFilterView.representatives}"/>
                    </p:selectOneMenu>
                </f:facet>

                <p:graphicImage name="images/avatar/#{customer.representative.image}" library="demo" width="32"
                                style="vertical-align: middle"/>
                <h:outputText style="vertical-align: middle; margin-left: .5rem"
                              value="#{customer.representative.name}"/>
            </p:column>

            <p:column field="date" headerText="Join Date" filterMatchMode="between" sortable="false">
                <f:facet name="filter">
                    <p:datePicker selectionMode="range" onchange="PF('customersTable').filter()"
                                  styleClass="white-space-nowrap"
                                  converter="jakarta.faces.DateTime" showOnFocus="false" showIcon="true"/>
                </f:facet>
            </p:column>

            <p:column field="status" headerText="Status" filterMatchMode="exact" sortable="false">
                <f:facet name="filter">
                    <p:selectOneMenu onchange="PF('customersTable').filter()" styleClass="ui-custom-filter">
                        <f:selectItem itemLabel="All" itemValue="#{null}" noSelectionOption="true"/>
                        <f:selectItems value="#{dtFilterView.customerStatus}"/>
                    </p:selectOneMenu>
                </f:facet>

                <span class="customer-badge status-#{customer.status.statusName}">#{customer.status.statusName}</span>
            </p:column>

            <p:column field="activity" headerText="Activity" filterMatchMode="gt" sortable="false"
                      converter="jakarta.faces.Integer">
                <p:progressBar value="#{customer.activity}" displayOnly="true" style="height: .5rem"/>
            </p:column>

        </p:dataTable>
    </h:form>
</div>
<div class="card">
    <h5>Default Filter</h5>
    <h:form>
        <p:dataTable var="customer" value="#{dtFilterView.customers2}" widgetVar="customersTable2"
                     emptyMessage="No customers found with given criteria"
                     filteredValue="#{dtFilterView.filteredCustomers2}" filterBy="#{dtFilterView.filterBy}">

            <f:facet name="header">
                <span>List of Customers</span>
            </f:facet>

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

            <p:column headerText="Country" sortBy="#{customer.country.name}"
                      filterBy="#{customer.country.name}">
                <span class="flag flag-#{customer.country.code}" style="width: 30px; height: 20px"/>
                <h:outputText style="vertical-align: middle; margin-left: .5rem"
                              value="#{customer.country.name}"/>
            </p:column>

            <p:column field="representative" headerText="Representative" filterMatchMode="exact"
                      sortBy="#{customer.representative.name}">
                <f:facet name="filter">
                    <p:selectOneMenu onchange="PF('customersTable2').filter()" styleClass="custom-filter">
                        <f:selectItem itemLabel="All" itemValue="#{null}" noSelectionOption="true"/>
                        <f:selectItems value="#{dtFilterView.representatives}"/>
                    </p:selectOneMenu>
                </f:facet>

                <p:graphicImage name="images/avatar/#{customer.representative.image}" library="demo" width="32"
                                style="vertical-align: middle"/>
                <h:outputText style="vertical-align: middle; margin-left: .5rem"
                              value="#{customer.representative.name}"/>
            </p:column>

            <p:column field="date" headerText="Join Date" filterMatchMode="between">
                <f:facet name="filter">
                    <p:datePicker selectionMode="range" onchange="PF('customersTable2').filter()"
                                  styleClass="ui-custom-filter"/>
                </f:facet>
            </p:column>

            <p:column field="status" headerText="Status" filterMatchMode="exact">
                <f:facet name="filter">
                    <p:selectOneMenu onchange="PF('customersTable2').filter()" styleClass="ui-custom-filter">
                        <f:selectItem itemLabel="All" itemValue="#{null}" noSelectionOption="true"/>
                        <f:selectItems value="#{dtFilterView.customerStatus}"/>
                    </p:selectOneMenu>
                </f:facet>

                <span class="customer-badge status-#{customer.status.statusName}">#{customer.status.statusName}</span>
            </p:column>

            <p:column field="activity" headerText="Activity" sortBy="#{customer.activity}"
                      converter="jakarta.faces.Integer">
                <p:progressBar value="#{customer.activity}" displayOnly="true" style="height: .5rem"/>
            </p:column>
        </p:dataTable>
    </h:form>
</div>
<div class="card">
    <h5>Global Filter Function</h5>
    <h:form>
        <p:dataTable var="customer" value="#{dtFilterView.customers3}" widgetVar="customersTable3"
                     emptyMessage="No customers found with given criteria"
                     filteredValue="#{dtFilterView.filteredCustomers3}"
                     globalFilterFunction="#{dtFilterView.globalFilterFunction}">

            <f:facet name="header">
                <div class="flex justify-content-end">
                    <p:inputText id="globalFilter"
                                 onkeyup="PrimeFaces.debounce(() => PF('customersTable3').filter())"
                                 style="width:300px"
                                 placeholder="Search all fields using global function"/>
                </div>
            </f:facet>

            <p:column field="name" filterable="false"/>

            <p:column headerText="Country" sortBy="#{customer.country.name}">
                <span class="flag flag-#{customer.country.code}" style="width: 30px; height: 20px"/>
                <h:outputText style="vertical-align: middle; margin-left: .5rem"
                              value="#{customer.country.name}"/>
            </p:column>

            <p:column field="representative" headerText="Representative" filterable="false">
                <p:graphicImage name="images/avatar/#{customer.representative.image}" library="demo" width="32"
                                style="vertical-align: middle"/>
                <h:outputText style="vertical-align: middle; margin-left: .5rem"
                              value="#{customer.representative.name}"/>
            </p:column>

            <p:column field="date" filterable="false"/>

            <p:column field="status" filterable="false">
                <span class="customer-badge status-#{customer.status.statusName}">#{customer.status.statusName}</span>
            </p:column>

            <p:column headerText="Activity" sortBy="#{customer.activity}">
                <p:progressBar value="#{customer.activity}" displayOnly="true" style="height: .5rem"/>
            </p:column>
        </p:dataTable>
    </h:form>
</div>

<div class="card">
    <h5>Filter toggling</h5>
    <p>1. Hide filter components initially by adding <code>ui-filter-togglable</code> as
        <em>styleClass</em> to the datatable. <br/>
        2. To show/hide the filter components call <code>PF('customersTable4').toggleFilter()</code>.</p>
    <h:form id="customersForm4">
        <p:dataTable id="customers" var="customer" value="#{dtFilterView.customers1}"
                     widgetVar="customersTable4"
                     emptyMessage="No customers found with given criteria" stickyHeader="true"
                     stickyTopAt=".layout-topbar"
                     filteredValue="#{dtFilterView.filteredCustomers1}" styleClass="ui-filter-togglable">

            <f:facet name="header">
                <div class="flex align-items-center justify-content-between">
                    <span>List of Customers</span>
                    <div align="right">
                        <span>Switch toggle with manual toggleFilter()</span>
                        <p:toggleSwitch id="manualToggle" styleClass="vertical-align-middle ml-3"
                                        onchange="PF('customersTable4').toggleFilter()" onIcon="pi pi-filter"
                                        offIcon="pi pi-filter-slash"/>
                    </div>
                </div>

            </f:facet>

            <p:column headerText="Name" sortBy="#{customer.name}" filterBy="#{customer.name}"
                      filterMatchMode="contains" filterPlaceholder="Filter By Name">
                <h:outputText value="#{customer.name}"/>
            </p:column>

            <p:column headerText="Country" sortBy="#{customer.country.name}"
                      filterBy="#{customer.country.name}">
                <span class="flag flag-#{customer.country.code}" style="width: 30px; height: 20px"/>
                <h:outputText style="vertical-align: middle; margin-left: .5rem"
                              value="#{customer.country.name}"/>
            </p:column>

            <p:column field="representative" headerText="Representative" filterMatchMode="exact"
                      sortBy="#{customer.representative.name}">
                <f:facet name="filter">
                    <p:selectOneMenu onchange="PF('customersTable').filter()" styleClass="ui-custom-filter">
                        <f:selectItem itemLabel="All" itemValue="#{null}" noSelectionOption="true"/>
                        <f:selectItems value="#{dtFilterView.representatives}"/>
                    </p:selectOneMenu>
                </f:facet>

                <p:graphicImage name="images/avatar/#{customer.representative.image}" library="demo" width="32"
                                style="vertical-align: middle"/>
                <h:outputText style="vertical-align: middle; margin-left: .5rem"
                              value="#{customer.representative.name}"/>
            </p:column>

            <p:column field="date" headerText="Join Date" filterMatchMode="between">
                <f:facet name="filter">
                    <p:datePicker selectionMode="range" onchange="PF('customersTable').filter()"
                                  converter="jakarta.faces.DateTime"/>
                </f:facet>
            </p:column>

            <p:column field="status" headerText="Status" filterMatchMode="exact">
                <f:facet name="filter">
                    <p:selectOneMenu onchange="PF('customersTable').filter()" styleClass="ui-custom-filter">
                        <f:selectItem itemLabel="All" itemValue="#{null}" noSelectionOption="true"/>
                        <f:selectItems value="#{dtFilterView.customerStatus}"/>
                    </p:selectOneMenu>
                </f:facet>

                <span class="customer-badge status-#{customer.status.statusName}">#{customer.status.statusName}</span>
            </p:column>

            <p:column field="activity" headerText="Activity" sortBy="#{customer.activity}" filterMatchMode="gt"
                      converter="jakarta.faces.Integer">
                <p:progressBar value="#{customer.activity}" displayOnly="true" style="height: .5rem"/>
            </p:column>
        </p:dataTable>
    </h:form>
</div>