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!
This should work
filterBy="#{user.firstName} #{user.lastName}"
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