Filter on all the rows of all the pages in a data table

Hi Guys,

With Filter Input control, I would like to do ‘server side filtering’ on all the columns of an async data table. Is this possible?

To elaborate more, I have a data table and a filter input control. Binded filter input control to the table. When user enters filter criteria in the filter input control, it does filtering on all rows but ‘only client side’. i.e., filter is applied only on the table page displayed at that instance to user. But What I need is the filter control to filter the data on all rows from all the pages.

I am able to do the ‘server side’ filtering on any one column (by changing the table provider type to FilterableSelectableListTableContentProvider and binding any one column to filter on). However, I would need this filtering on all columns. Is this possible / Are there any alternatives?

Kind regards,
Raj

The FilterableSelectableListTableContentProvider rowFilterValueBinding expression just needs to resolve to a string that can be compared to the user supplied filter string to check for a match in each row.

So you can set that to an expression to calls a custom method that you create that would return a string representation of the row to compare the filter against.

For example, add a custom method to your managed bean that returns a string:

public String getMyFilterValue() {
	return (String)resolveExpression("#{row.field1} #{row.field2} #{row.field3}");
}

And then use an expression that resolves to that method as the rowFilterValueExpression:

#{TestDefaultviewView.myFilterValue}

Or for most typical use cases, you can simply set the rowFilterValueBinding value directly to an expression the concatenates all the fields you want to filter on together into a string. In this case you don’t need any custom java code.

For example, instead of setting the rowFilterValueBinding value to a value that resolves to the data for one column:

#{row.field1}

You could instead set the rowFilterValueBinding value to something like the following that would product a string with the 3 fields concatenated together seperated by a space character:

#{row.field1} #{row.field2} #{row.field3}
1 Like