Primefaces dataTable applying filter on multiple field in a single column

datatable, filtering, jsf, primefaces

Solution

This should work

filterBy="#{user.firstName} #{user.lastName}"

Problem

I have a `p:datatable` which lists users. One of the column contains the concatenated First Name + Last Name of the user and I'd like to be able to filter on both these values in the same 'filter field' so that it tries to match the filter on the name as well as on the first name. i.e.: users: "Bob Green" and "Steve Ross", if I enter the filter 'o', both users will appear in the filtered list. The dataTable: ``` <p:dataTable id="users" value="#{userCtrl.userList}" filteredValue="#{userCtrl.filteredUserList}" var="user" sortMode="multiple"> <!-- FIRST NAME + LAST NAME --> <p:column id="col_name" filterBy="#{user.name} ADD SOMETHING HERE FOR FIRST NAME?" headerText="Name" filterMatchMode="contains"> <h:outputText value="#{user.firstName} #{user.lastName}" /> </p:column> </p:dataTable> ``` Both the attributes firstName and lastName are Strings. Any ideas if something like this is doable ? Thank you!

Original source