How can I customize the filter function for SelectOneMenu

Gökhan Memiş picture Gökhan Memiş · Apr 14, 2015 · Viewed 7.8k times · Source

I tried to find on Primefaces Documentation but I have not found how can I customize the filter function for SelectOneMenu.

I add filterMatchMode="custom" filterFunction="#{mainRandevuBean.ilFilter()}"

But I don't know how can I write bean filterFunction.

Answer

Kukeltje picture Kukeltje · Apr 14, 2015

The filter is a javascript (client-side) function. It all IS in the PrimeFaces documentation, which you should always look into first, carefully, thouroughly.

So use filterFunction="myFilter"

and create a javascript function like

function myFilter(itemLabel, filterValue) {
     // return true if this label matches, false otherwise
}