Thursday, December 8, 2011

How to Reset ADF Table filter values by single button click

Problem : If you noticed anytime using ADF table component enabled filters for all/some of the columns. If you perform filter using one or multiple columns , Then user manually has to remove filter criteria to perform any further search on ADF table component.

To explain more clear : Let us assume ADF table component with 5 columns and filter criteria enabled for each column. If user enters filter criteria for col1, col2, col3 and col4 and hit Enter button , User will find the search results based on filter criteria entered in above columns, If user decided to perform search back without any filters, User has to manually remove the entered filter criteria and then perform search

Solution :
-> Create a command button on UI screen and bind to a backing bean method
-> In Method implementation , get FilterableQueryDescriptor from the ADF Table which is binded to backing bean
-> Clear the filter criteria.
Eg Code Snippet:

public void resetFilter(ActionEvent actionEvent)
{
// Add event code here...
FilterableQueryDescriptor queryDescriptor =

(FilterableQueryDescriptor) .getBindTable().getFilterModel();

if (queryDescriptor != null &&
queryDescriptor.getFilterCriteria() != null)

{

queryDescriptor.getFilterCriteria().clear();

getTollsntaxes().queueEvent(new QueryEvent(getBindTable(),
queryDescriptor));

}

4 comments:

  1. Hi,
    what is getTollsntaxes() developer is not recognized and their is nothing in the intent about it ?

    Thank you

    ReplyDelete
  2. Very interesting stuff to read and to share it good job and thanks for sharing such a good blog. Keep posting more blogs like this thank you.
    Oracle Fusion HCM Technical Online Training

    ReplyDelete