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
Rodrigues Campain United KingdomBernardo Dominic2025-04-02 RENEWAL
Ivar Paprocki IndiaAmy Elsner2025-03-30 NEW
Sinclair Waycott AustraliaStephen Shaw2025-03-23 RENEWAL
Mujtaba Nicka BrazilAsiya Javayant2025-03-06 NEGOTIATION
Sinclair Waycott RussiaBernardo Dominic2025-03-06 NEGOTIATION
Morrow Ruta AustraliaIvan Magalhaes2025-03-18 PROPOSAL
Wickens Nestle United KingdomOnyama Limba2025-03-24 NEW
Clifford Rim SpainAsiya Javayant2025-03-19 RENEWAL
Aruna Figeroa GermanyStephen Shaw2025-03-25 NEW
Francesco Shinko IndiaOnyama Limba2025-03-14 QUALIFIED
Default Filter
List of Customers
NameCountryRepresentative
Join Date
Status
Activity
Clifford Rim ArgentinaXuxue Feng2025-03-21 NEW
Cody Saylors IndiaAsiya Javayant2025-04-02 NEW
Kadeem Flosi ArgentinaAmy Elsner2025-03-13 NEW
Wickens Nestle GermanyAsiya Javayant2025-03-17 NEW
Silvio Slusarski ArgentinaBernardo Dominic2025-03-21 NEW
Jefferson Schemmer FranceAsiya Javayant2025-03-14 NEW
Global Filter Function
NameCountryRepresentativeDateStatusActivity
Costa Dilliard GermanyXuxue Feng2025-03-06 QUALIFIED
Costa Dilliard JapanOnyama Limba2025-03-31 NEGOTIATION
Isabel Bowley CanadaOnyama Limba2025-04-03 RENEWAL
Jefferson Schemmer RussiaBernardo Dominic2025-03-24 QUALIFIED
Arvin Albares IndiaOnyama Limba2025-03-29 PROPOSAL
Ashley Doe GermanyIoni Bowcher2025-03-24 NEW
Kadeem Flosi FranceOnyama Limba2025-03-10 RENEWAL
Johnson Sergi FranceIoni Bowcher2025-03-30 NEW
Francesco Shinko IndiaStephen Shaw2025-03-27 NEW
Clifford Rim AustraliaAnna Fali2025-03-27 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
Rodrigues Campain United KingdomBernardo Dominic2025-04-02 RENEWAL
Ivar Paprocki IndiaAmy Elsner2025-03-30 NEW
Sinclair Waycott AustraliaStephen Shaw2025-03-23 RENEWAL
Mujtaba Nicka BrazilAsiya Javayant2025-03-06 NEGOTIATION
Sinclair Waycott RussiaBernardo Dominic2025-03-06 NEGOTIATION
Morrow Ruta AustraliaIvan Magalhaes2025-03-18 PROPOSAL
Wickens Nestle United KingdomOnyama Limba2025-03-24 NEW
Clifford Rim SpainAsiya Javayant2025-03-19 RENEWAL
Aruna Figeroa GermanyStephen Shaw2025-03-25 NEW
Francesco Shinko IndiaOnyama Limba2025-03-14 QUALIFIED

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