By default, primeface filter dataTable's rows, by finding rows that columns begins with the string entered in the search area. How do I filter the DataTable rows that the column contains (not begins with) the string entered in the search area?
You can do this using filterMatchMode
attribute on p:column
of the dataTable. A very good example can be found on PrimeFaces showcase.
So if we take the above mentioned example, you could have roughly something like this:
<p:dataTable var="car" value="#{dtFilterView.cars}" widgetVar="carsTable"
filteredValue="#{dtFilterView.filteredCars}">
<p:column filterBy="#{car.id}" headerText="Id" footerText="contains"
filterMatchMode="contains">
<h:outputText value="#{car.id}" />
</p:column>
</p:dataTable>
The attribute filterMatchMode
accepts values such as contains, endsWith, startsWith, exact...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With