eclipse-nattable / nattable

High performance SWT data grid
https://eclipse.dev/nattable/
Eclipse Public License 2.0
11 stars 6 forks source link

[Filter] Unexpected behavior with filtered combobox filter content #63

Closed fipro78 closed 3 months ago

fipro78 commented 4 months ago

With #57 we introduced an option to add a filter on the filter combobox content. This way it is possible to avoid that some values can be filtered.

This is causing some strange side effects in some situations. For example, if you applied a filter for a column, and afterwards perform an action that would filter the filter combobox content (e.g. some action that excludes values from the filter), the filterrow would show an active filter, although no filter is applied.

The reasons seems to be ComboBoxFilterUtils.isAllSelected(int, Object, IComboBoxDataProvider)and the fact that after the first filter operation, the filter values are cached. Which leads to the issue, because the values that are now available in the combobox are not the same as before.

fipro78 commented 3 months ago

After further investigation, the issue is the usage of ObjectUtils.collectionEquals() in ComboBoxFilterUtils.isAllSelected(int, Object, IComboBoxDataProvider). The following actions trigger the issue:

By performing these steps the data value for the filter row cell is a collection of all possible values and not SELECT_ALL.

If now a content filter is set to the FilterRowComboBoxDataProvider, the data collection returned by the data provider is smaller than the collection of possible values. As an equals check is performed, a filtered collection is never the same as the collection of all possible values.

Semantically correct is also if all values available in the combo (filtered all values) are CONTAINED in the all possible values list set in the filter. Therefore the fix should be to change the equals check to a containsAll()