Friday, 22 June 2018

Clear the table filters programmatically


This blog we will see how to clear the table filters programmatically.

The below code we need to add to clear the table filter
jspx/jsff:
 Bean:

    public void resetFilter(ActionEvent actionEvent) {
        FilterableQueryDescriptor fqd = (FilterableQueryDescriptor)t1.getFilterModel();
               if (fqd != null && fqd.getFilterCriteria() != null) {
                 fqd.getFilterCriteria().clear();
                 t1.queueEvent(new QueryEvent(t1, fqd));          
              }
    }

  Thanks..

2 comments:

  1. Hi,

    How to reset data and filters both on same button click action?

    Thanks,
    Vishal Kumar

    ReplyDelete
  2. This Approach is usable with out clicking any button
    Step1: Create one Variable like Private String clearFilter.
    Step2: Create setters and getters for that variable.
    Step3: write the above code in getter method.
    Step4: user that getter method as a value for output text and make that output text visible="false".

    ReplyDelete