JDeveloper 12.2.1.4
Hi
We are currently using the code below from Timo to remove table filters.
It works correctly. (thanks Timo)
public static void resetTableFilter(RichTable rt, Boolean refreshTable) {
FilterableQueryDescriptor queryDescriptor = (FilterableQueryDescriptor) rt.getFilterModel();
if (queryDescriptor != null && queryDescriptor.getFilterConjunctionCriterion() != null) {
ConjunctionCriterion cc = queryDescriptor.getFilterConjunctionCriterion();
List<Criterion> lc = cc.getCriterionList();
for (Criterion c : lc) {
if (c instanceof AttributeCriterion) {
AttributeCriterion ac = (AttributeCriterion) c;
ac.setValue(null);
}
}
if (refreshTable)
rt.queueEvent(new QueryEvent(rt, queryDescriptor));
}
}
The problem we have is that if the user applies a filter and we then iterate over the rows with a rowset iterator
the filter is still being applied.
Basically the user applies a filter, then clicks a button which calls a method in the application module.
in other words :
ViewObjectImpl vo = getOurView();
RowSetIterator rsi = vo.createRowSetIterator(null);
rsi.reset();
while (rsi.hasNext()) {
Row r = rsi.next();
… etc
We tried calling the above code in the button before calling the method in the application module before but it seems that the table refresh occurs too late (and gives a null pointer as when the user clicks on the button we are navigating away from the page)
We have also tried removing the viewcriteria ie.
for (String criteriaName : appliedCriteriaNames) {
System.out.println("------------------> Applied View Criteria: " + criteriaName);
// vo.getViewCriteriaManager().removeViewCriteria(criteriaName);
vo.getViewCriteriaManager().clearViewCriterias();
}
But it does't seem to remove the filter on the VO
What's the best way to remove a table filter at the vo level before iterating over the rows.
Do we need to re-execute the vo ? If so how do we preserve uncommitted data ?
Thanks in advance
Paul