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
Arvin Albares FranceIvan Magalhaes2025-06-02 QUALIFIED
Munro Ferencz ItalyElwin Sharvill2025-06-09 UNQUALIFIED
Julie Stenseth AustraliaElwin Sharvill2025-06-01 NEGOTIATION
Deepesh Chui IndiaIoni Bowcher2025-06-22 PROPOSAL
Octavia Malet SpainIoni Bowcher2025-06-06 UNQUALIFIED
Antonio Caudy ItalyAnna Fali2025-05-28 NEGOTIATION
Greenwood Bolognia FranceIoni Bowcher2025-06-15 NEW
Murillo Malet JapanOnyama Limba2025-06-12 RENEWAL
Aika Inouye United KingdomBernardo Dominic2025-06-04 QUALIFIED
Alejandro Perin BrazilIvan Magalhaes2025-06-12 PROPOSAL
Default Filter
List of Customers
NameCountryRepresentative
Join Date
Status
Activity
James Butt ItalyElwin Sharvill2025-06-11 NEW
Jeanfrancois Venere AustraliaIvan Magalhaes2025-06-08 NEW
Leja Caldarera United KingdomOnyama Limba2025-06-12 NEW
James Butt SpainAsiya Javayant2025-05-30 NEW
Julie Stenseth GermanyAmy Elsner2025-06-18 NEW
Salvatore Stockham United KingdomStephen Shaw2025-06-01 NEW
Maria Marrier GermanyAnna Fali2025-05-29 NEW
Ivar Paprocki FranceIvan Magalhaes2025-05-28 NEW
Emily Whobrey BrazilElwin Sharvill2025-06-08 NEW
Jones Vocelka AustraliaStephen Shaw2025-06-06 NEW
Tony Foller RussiaAmy Elsner2025-06-16 NEW
Global Filter Function
NameCountryRepresentativeDateStatusActivity
Mayumi Kolmetz FranceBernardo Dominic2025-06-20 UNQUALIFIED
Mujtaba Nicka SpainAsiya Javayant2025-06-06 RENEWAL
Deepesh Chui SpainElwin Sharvill2025-05-30 NEW
Leon Oldroyd IndiaStephen Shaw2025-05-29 PROPOSAL
Juan Wieser BrazilBernardo Dominic2025-06-07 NEGOTIATION
Isabel Bowley AustraliaElwin Sharvill2025-06-18 NEGOTIATION
Jones Vocelka ArgentinaAnna Fali2025-06-03 PROPOSAL
Jeanfrancois Venere ItalyXuxue Feng2025-06-09 UNQUALIFIED
Smith Glick SpainBernardo Dominic2025-06-07 NEGOTIATION
David Darakjy RussiaStephen Shaw2025-06-21 QUALIFIED
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
Arvin Albares FranceIvan Magalhaes2025-06-02 QUALIFIED
Munro Ferencz ItalyElwin Sharvill2025-06-09 UNQUALIFIED
Julie Stenseth AustraliaElwin Sharvill2025-06-01 NEGOTIATION
Deepesh Chui IndiaIoni Bowcher2025-06-22 PROPOSAL
Octavia Malet SpainIoni Bowcher2025-06-06 UNQUALIFIED
Antonio Caudy ItalyAnna Fali2025-05-28 NEGOTIATION
Greenwood Bolognia FranceIoni Bowcher2025-06-15 NEW
Murillo Malet JapanOnyama Limba2025-06-12 RENEWAL
Aika Inouye United KingdomBernardo Dominic2025-06-04 QUALIFIED
Alejandro Perin BrazilIvan Magalhaes2025-06-12 PROPOSAL

<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>