Sorting mappable columns

This commit is contained in:
Jarosław Sadziński 2024-10-02 10:00:43 +02:00
parent 4b8f10fc12
commit fb8de2dbe7

View File

@ -75,11 +75,13 @@ class ColumnPicker extends Disposable {
void use(refreshTrigger);
const columnsAsOptions: IOption<number|null>[] = 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.