remove criteria

Rephrasing …

I have a Criteria object with all the currently selected criteria in a ListGrid.

How do I remove a specific criteria ?

There is DataSource.combineCriteria(c1, c2) to merge 2 criteria, but there is NO way to remove criteria !


Hi,

I have a list grid that shows “grouped” data.
Let’s say it has only the USER and COST columns.

I want to filter with date range, but I do not (and cannot) have that column shown.

I managed to do that with an external filter.

PROBLEM: a second filtering, with a different date range doesn’t work because it keeps the old date range as well.

Criteria existingCriteria = listView.getFilterEditorCriteria(); // Why: because there might be a filter on the user to show
Criteria filterCriteria = range.getCriterion();
					
Criteria allCriteria = DataSource.combineCriteria(existingCriteria, filterCriteria);

listView.fetchData(allCriteria);

I need the filters already set in the list (like user name), except the date range filter that I added externally. How do I remove just that one ?

Hi,

I would also be interested in a API to remove specific criteria.

This should be fairly straightforward to achieve by creating a new AdvancedCriteria object, and selectively adding the criteria you want to it, omitting any that you don’t want.
Let us know if you can’t get this working for any reason.

Yeah, that’s how I solved it,
but it costs me several lines of code.

I try to introduce a CriteriaUtil as less as possible.

Thanks,