From 8e2831ae6a403035968aeed0434fde5d0ab51420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Sadzi=C5=84ski?= Date: Wed, 2 Oct 2024 10:00:43 +0200 Subject: [PATCH] Sorting mappable columns --- app/client/ui/CustomSectionConfig.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/client/ui/CustomSectionConfig.ts b/app/client/ui/CustomSectionConfig.ts index 9163bb11..52e0f78c 100644 --- a/app/client/ui/CustomSectionConfig.ts +++ b/app/client/ui/CustomSectionConfig.ts @@ -75,11 +75,13 @@ class ColumnPicker extends Disposable { void use(refreshTrigger); const columnsAsOptions: IOption[] = use(canBeMapped) - .map((col) => ({ - value: col.getRowId(), - label: col.label.peek(), - icon: 'FieldColumn', - })); + .map((col) => ({ + value: col.getRowId(), + label: col.label.peek() || '', + icon: 'FieldColumn', + })); + // Order it by label. + columnsAsOptions.sort((a, b) => a.label.localeCompare(b.label)); // For optional mappings, add 'Blank' option but only if the value is set. // This option will allow to clear the selection.