Skip to content

Commit

Permalink
Sort ungrouped items at bottom. (#3872)
Browse files Browse the repository at this point in the history
* Sort ungrouped items at bottom.

* Fix from gsolomon code review
  • Loading branch information
lbwexler authored Dec 26, 2024
1 parent 06078a2 commit 2368d09
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 5 additions & 1 deletion cmp/grid/GridModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,11 @@ export class GridModel extends HoistModel {
}

defaultGroupSortFn = (a, b) => {
return a < b ? -1 : a > b ? 1 : 0;
// Place ungrouped items at bottom.
if (a === b) return 0;
if (a === '') return 1;
if (b === '') return -1;
return a.localeCompare(b);
};

private readonly LEFT_BORDER_CLASS = 'xh-cell--group-border-left';
Expand Down
6 changes: 0 additions & 6 deletions desktop/cmp/viewmanager/dialog/ManageDialogModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,6 @@ export class ManageDialogModel extends HoistModel {
sortBy: 'name',
showGroupRowCounts: false,
groupBy: ['group'],
groupSortFn: (a, b) => {
// Place ungrouped items at bottom.
if (a == '') return 1;
if (b == '') return -1;
return a.localeCompare(b);
},
selModel: 'multiple',
contextMenu: null,
sizingMode: 'standard',
Expand Down

0 comments on commit 2368d09

Please sign in to comment.