Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Remove table filter before iterating over rows

Paul (MITsa)Feb 4 2025 — edited Feb 4 2025

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

Comments

Processing

Post Details

Added on Feb 4 2025
2 comments
178 views