Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 581321

Summary: [GroupBy] list order changed after grouping a filtered list
Product: [Technology] NatTable Reporter: Dirk Fauth <dirk.fauth>
Component: GlazedLists ExtensionAssignee: Dirk Fauth <dirk.fauth>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0.5   
Target Milestone: 2.1.0   
Hardware: PC   
OS: Windows 10   
See Also: https://git.eclipse.org/r/c/nattable/org.eclipse.nebula.widgets.nattable/+/199331
https://git.eclipse.org/c/nattable/org.eclipse.nebula.widgets.nattable.git/commit/?id=d442cdfbd33a79fe1dfd55ab427cd34768a65614
https://git.eclipse.org/r/c/nattable/org.eclipse.nebula.widgets.nattable/+/199793
https://git.eclipse.org/c/nattable/org.eclipse.nebula.widgets.nattable.git/commit/?id=c9c39eceb8551fbf918e413d9f772866640796fd
https://git.eclipse.org/r/c/nattable/org.eclipse.nebula.widgets.nattable/+/199866
https://git.eclipse.org/c/nattable/org.eclipse.nebula.widgets.nattable.git/commit/?id=a2ddc51551187c49de9d2be449c1a23b97cd255a
https://git.eclipse.org/r/c/nattable/org.eclipse.nebula.widgets.nattable/+/200357
https://git.eclipse.org/c/nattable/org.eclipse.nebula.widgets.nattable.git/commit/?id=367ca992748c2f6bb751314cd62f9bb8e51b38e9
Whiteboard:

Description Dirk Fauth CLA 2023-01-11 05:08:31 EST
If you have a combination of filter row and groupby header, the following sequence is causing a change of the initial list ordering.

1. apply a filter
2. perform a groupby
3. remove the groupby
4. remove the filter

After this sequence the previously visible items will be reordered to the end of the list (e.g. filter by lastname "Carlson", all "Carlson" objects).

The reason for this behavior is a performance fix applied via Bug 425641. To update the tree structure, it is necessary to add all items in the underlying list again, so the update events cause a rebuilding of the tree structure. This can be done by iterating over the whole collection and setting the element to the same position. For huge lists this was a very long taking operation. The fix was to use clear()-addAll() to reduce the number of operations. Unfortunately this is causing the described side effect, as the entries in the list are not updated but removed and added again in the current ordering.

Similar to the fixes related to sorting in this context, the fix for this issue is to remove the filter before the tree is updated and re-apply the filter once the tree update is finished. For this the GroupByDataLayer needs the FilterRowDataProvider to be set.
Comment 1 Eclipse Genie CLA 2023-01-11 05:37:57 EST
New Gerrit change created: https://git.eclipse.org/r/c/nattable/org.eclipse.nebula.widgets.nattable/+/199331
Comment 3 Eclipse Genie CLA 2023-02-07 05:47:04 EST
New Gerrit change created: https://git.eclipse.org/r/c/nattable/org.eclipse.nebula.widgets.nattable/+/199793
Comment 5 Eclipse Genie CLA 2023-02-13 04:53:13 EST
New Gerrit change created: https://git.eclipse.org/r/c/nattable/org.eclipse.nebula.widgets.nattable/+/199866
Comment 7 Eclipse Genie CLA 2023-03-06 04:26:06 EST
New Gerrit change created: https://git.eclipse.org/r/c/nattable/org.eclipse.nebula.widgets.nattable/+/200357
Comment 9 Dirk Fauth CLA 2023-03-31 03:49:06 EDT
Fixed with 2.1.0