From 2368d0938e2c61a5f38d7e7a199127b57e39590a Mon Sep 17 00:00:00 2001 From: Lee Wexler Date: Thu, 26 Dec 2024 15:59:55 -0500 Subject: [PATCH] Sort ungrouped items at bottom. (#3872) * Sort ungrouped items at bottom. * Fix from gsolomon code review --- cmp/grid/GridModel.ts | 6 +++++- desktop/cmp/viewmanager/dialog/ManageDialogModel.ts | 6 ------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/cmp/grid/GridModel.ts b/cmp/grid/GridModel.ts index f8042dc5e..cd82b578a 100644 --- a/cmp/grid/GridModel.ts +++ b/cmp/grid/GridModel.ts @@ -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'; diff --git a/desktop/cmp/viewmanager/dialog/ManageDialogModel.ts b/desktop/cmp/viewmanager/dialog/ManageDialogModel.ts index 098238ba3..7e16cef25 100644 --- a/desktop/cmp/viewmanager/dialog/ManageDialogModel.ts +++ b/desktop/cmp/viewmanager/dialog/ManageDialogModel.ts @@ -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',