Issue: Clearing the values entered in QBE (Query by example) and Sort fields of a table
If the user enters a value in the QBE or filter and perform some kind of sort on fields above the header of the attribute columns the values are not cleared even after reset.
It keeps the values and applies the Sort and filter criteria even after reset and search.
Solution:
The utility method below would clear out both the filter and Sort criteria applied by the user on click of reset.
The utility method takes the results table and the Iterator as the input and clears the sort and filter criteria applied by the user.
To call the method you have to write the custom query operation listener and check if the operation name is RESET.
public static void clearFilterCriteria(RichTable targetTable, String iterator) {
targetTable.queueEvent(new SortEvent(targetTable,new ArrayList<SortCriterion>()));
SortCriteria[] sc = new SortCriteria[0];
//Clears the Sort Criteria ADFUtils.findIterator(iterator).applySortCriteria(sc);
FilterableQueryDescriptor queryDescriptor = (FilterableQueryDescriptor)targetTable.getFilterModel();
if (queryDescriptor != null && queryDescriptor.getFilterCriteria() != null) { // Clears the Filter Criteria queryDescriptor.getFilterCriteria().clear();}
}}