user3016421
user3016421

Reputation: 119

How to use filter in JSF richface data table as "Contains" or "Ends With"

I am using JSF richface. I am using Filters in data table.

<rich:column width="50px" label="Item Name" align="center" 
filterBy="#{list.itemName}"  filterEvent="onkeyup"
filterValue="#{Bean.itemFilter}"    filterType="custom">                                    
    <h:inputText id="item"  value="#{list.itemName}" styleClass="rsInput" disabled="true" />
</rich:column>

Here #{Bean.itemFilter} is a string variable. I have no idea about this.

It works like "Starts with" for given search keyword. If a letter 'A' is typed, it brings item name starts with 'A'. But I need to get item name contains 'A'(may be at anywhere).

I need to use filter like "contains" or "Ends with". How can I approach this?

Upvotes: 1

Views: 1948

Answers (1)

Makhiel
Makhiel

Reputation: 3884

@filterBy is set to use "starts with" as the filtering method, if you want different filtering use @filterMethod - referencing a method that accepts Object and returns boolean, or @filterExpression - simple EL expression that evaluates to a boolean. (rich:column docs)

Upvotes: 3

Related Questions