JARCH SHOWCASE
JARCH SHOWCASE
DataTable - Filter Filtering updates the data based on the constraints.
Search all fields:
IdYear
Brand
Color
Status
All
Sold
Sale
Price
e5c7d45e2005JaguarMaroonSold$ 56.883,00
052383e21973HondaBlackSale$ 65.252,00
a146dd1b2003JaguarMaroonSale$ 29.521,00
2f0456221982MercedesOrangeSale$ 87.201,00
af278aa11961JaguarBlackSold$ 68.761,00
79b818b61971MercedesWhiteSold$ 50.415,00
a59704201997AudiOrangeSale$ 26.706,00
825e44f42008AudiBlueSale$ 46.696,00
5d3b6ece1988HondaWhiteSale$ 44.745,00
c30b85c11966VolvoBlueSold$ 67.572,00
containslteexactinequalscustom (min)
<a:form>
    <a:dataTable var="car" value="#{dtFilterView.cars}" widgetVar="carsTable"
                 emptyMessage="No cars found with given criteria" filteredValue="#{dtFilterView.filteredCars}">

        <f:facet name="header">
            <a:outputPanel>
                <h:outputText value="Search all fields:" />
                <a:inputText id="globalFilter" onkeyup="PF('carsTable').filter()" style="width:150px" placeholder="Enter keyword"/>
            </a:outputPanel>
        </f:facet>

        <a:column filterBy="#{car.id}" headerText="Id" footerText="contains" filterMatchMode="contains">
            <h:outputText value="#{car.id}" />
        </a:column>

        <a:column filterBy="#{car.year}" headerText="Year" footerText="lte" filterMatchMode="lte">
            <f:facet name="filter">
                <a:spinner onchange="PF('carsTable').filter()" styleClass="year-spinner">
                    <f:converter converterId="javax.faces.Integer" />
                </a:spinner>
            </f:facet>
            <h:outputText value="#{car.year}" />
        </a:column>

        <a:column filterBy="#{car.brand}" headerText="Brand" footerText="exact" filterMatchMode="exact">
            <f:facet name="filter">
                <a:selectOneMenu onchange="PF('carsTable').filter()" >
                    <f:selectItem itemLabel="Select One" itemValue="#{null}" noSelectionOption="true" />
                    <f:selectItems value="#{dtFilterView.brands}" />
                </a:selectOneMenu>
            </f:facet>
            <h:outputText value="#{car.brand}" />
        </a:column>

        <a:column filterBy="#{car.color}" headerText="Color" footerText="in" filterMatchMode="in">
            <f:facet name="filter">
                <a:selectCheckboxMenu label="Colors" onchange="PF('carsTable').filter()" panelStyle="width:125px" scrollHeight="150">
                    <f:selectItems value="#{dtFilterView.colors}" />
                </a:selectCheckboxMenu>
            </f:facet>
            <h:outputText value="#{car.color}" />
        </a:column>

        <a:column filterBy="#{car.sold}" headerText="Status" footerText="equals" filterMatchMode="equals">
            <f:facet name="filter">
                <a:selectOneButton onchange="PF('carsTable').filter()">
                    <f:converter converterId="javax.faces.Boolean" />
                    <f:selectItem itemLabel="All" itemValue="" />
                    <f:selectItem itemLabel="Sold" itemValue="true" />
                    <f:selectItem itemLabel="Sale" itemValue="false" />
                </a:selectOneButton>
            </f:facet>
            <h:outputText value="#{car.sold ? 'Sold': 'Sale'}" />
        </a:column>

        <a:column filterBy="#{car.price}" headerText="Price" footerText="custom (min)" filterFunction="#{dtFilterView.filterByPrice}">
            <h:outputText value="#{car.price}">
                <f:convertNumber currencySymbol="$" type="currency"/>
            </h:outputText>
        </a:column>
    </a:dataTable>
</a:form>
                
JARCH, Copyright © 2022 All rights reserved. Running JARCH 24.3.0-SNAPSHOT on PrimeFaces-12.0.0 on Mojarra-2.3.13.