JSF Primefaces datatable match mode for global filter (not individual column)

Viewed 14600

What is the filter match mode for global filter (not the individual column filter which defaults to 'startsWith') and how to change it?

The reason I ask is, when I use the global filter with match mode set to 'startsWith' in all my columns, still I get values with 'contains' filter mode. See screenshot below.

country table screenshot

I shouldn't be getting the rows other than the first row as I specified 'startsWith' in all columns.

Here is my datatable,

<h:form id="countryTable">
<p:dataTable rowKey="" value="#{countryBean.countriesList}"
    var="country" selection="#{countryBean.selectedCountries}"
    styleClass="data-table-style" widgetVar="countryTableWVar"
    filteredValue="#{countryBean.filteredCountries}">
    <f:facet name="header">
        <div class="align-left">
            <p:outputPanel>
                <h:outputText value="Search all fields:" />
                <p:inputText id="globalFilter" onkeyup="countryTableWVar.filter();"
                    style="width:150px" />
            </p:outputPanel>
        </div>

    </f:facet>
    <p:column selectionMode="multiple" style="width:2%;" />
    <p:column headerText="Numeric Code" filterMatchMode="startsWith"
        filterStyle="display:none" filterBy="numericCode">
        <h:outputText value="#{country.numericCode}"></h:outputText>
    </p:column>
    <p:column headerText="Alpha_2 Code" filterMatchMode="startsWith"
        filterStyle="display:none" filterBy="alpha2">
        <h:outputText value="#{country.alpha2}"></h:outputText>
    </p:column>
    <p:column headerText="Alpha_3 Code" filterMatchMode="startsWith"
        filterStyle="display:none" filterBy="alpha3">
        <h:outputText value="#{country.alpha3}"></h:outputText>
    </p:column>
    <p:column headerText="Name" filterMatchMode="startsWith"
        filterStyle="display:none" filterBy="name">
        <h:outputText value="#{country.name}"></h:outputText>
    </p:column>
</p:dataTable>
</h:form>

How to change the datatable global filter match mode?

2 Answers
Related