Locale

Language
English
English
English
French
German
German
German
Italian
Korean
Spanish
Catalan
Dutch
Portuguese
Portuguese
Arabic
Arabic
Bulgarian
Bangla
Bosnian
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
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
Clifford Rim ArgentinaIvan Magalhaes2025-01-13 PROPOSAL
Kaitlin Ostrosky RussiaAnna Fali2025-01-12 RENEWAL
Chavez Briddick ArgentinaStephen Shaw2025-01-08 PROPOSAL
Jefferson Schemmer FranceAnna Fali2025-01-03 PROPOSAL
Ivar Paprocki AustraliaAmy Elsner2024-12-29 NEW
Salvatore Stockham IndiaAmy Elsner2024-12-30 RENEWAL
Izzy Garufi FranceXuxue Feng2024-12-22 NEGOTIATION
Mujtaba Nicka GermanyOnyama Limba2025-01-02 NEW
David Darakjy FranceXuxue Feng2025-01-16 QUALIFIED
Leja Caldarera JapanAmy Elsner2025-01-14 RENEWAL
Default Filter
List of Customers
NameCountryRepresentative
Join Date
Status
Activity
Deepesh Chui ArgentinaOnyama Limba2025-01-08 NEW
Isabel Bowley ArgentinaIoni Bowcher2024-12-25 NEW
Jeanfrancois Venere BrazilStephen Shaw2024-12-21 NEW
Cody Saylors ItalyAnna Fali2024-12-26 NEW
Munro Ferencz AustraliaAnna Fali2024-12-22 NEW
Antonio Caudy FranceAnna Fali2025-01-06 NEW
Global Filter Function
NameCountryRepresentativeDateStatusActivity
Isabel Bowley ItalyBernardo Dominic2025-01-06 NEW
Deepesh Chui United KingdomOnyama Limba2024-12-29 UNQUALIFIED
Leja Caldarera GermanyAsiya Javayant2024-12-30 RENEWAL
Ivar Paprocki BrazilOnyama Limba2025-01-16 NEW
Costa Dilliard SpainIoni Bowcher2025-01-15 RENEWAL
Arvin Albares GermanyAnna Fali2024-12-22 PROPOSAL
James Butt IndiaIvan Magalhaes2025-01-12 NEW
Maria Marrier RussiaOnyama Limba2024-12-29 NEGOTIATION
Cody Saylors AustraliaIvan Magalhaes2024-12-29 NEW
Juan Wieser BrazilAsiya Javayant2024-12-30 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
Clifford Rim ArgentinaIvan Magalhaes2025-01-13 PROPOSAL
Kaitlin Ostrosky RussiaAnna Fali2025-01-12 RENEWAL
Chavez Briddick ArgentinaStephen Shaw2025-01-08 PROPOSAL
Jefferson Schemmer FranceAnna Fali2025-01-03 PROPOSAL
Ivar Paprocki AustraliaAmy Elsner2024-12-29 NEW
Salvatore Stockham IndiaAmy Elsner2024-12-30 RENEWAL
Izzy Garufi FranceXuxue Feng2024-12-22 NEGOTIATION
Mujtaba Nicka GermanyOnyama Limba2025-01-02 NEW
David Darakjy FranceXuxue Feng2025-01-16 QUALIFIED
Leja Caldarera JapanAmy Elsner2025-01-14 RENEWAL

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