Adding sort order for filters

This commit is contained in:
Jarosław Sadziński
2024-10-09 11:13:31 +02:00
parent 4cde2202b5
commit 1315cc366f
4 changed files with 15 additions and 8 deletions

View File

@@ -76,12 +76,13 @@ class ColumnPicker extends Disposable {
void use(refreshTrigger);
const columnsAsOptions: IOption<number|null>[] = use(canBeMapped)
.sort(labelsOrder)
.map((col) => ({
value: col.getRowId(),
label: col.label.peek() || '',
icon: 'FieldColumn',
}));
icon: 'FieldColumn' as const,
}))
.sort(labelsOrder);
// For optional mappings, add 'Blank' option but only if the value is set.
// This option will allow to clear the selection.

View File

@@ -4,6 +4,7 @@ import * as kf from 'app/client/lib/koForm';
import {makeT} from 'app/client/lib/localization';
import {addToSort, updatePositions} from 'app/client/lib/sortUtil';
import {ViewSectionRec} from 'app/client/models/DocModel';
import {labelsOrder} from 'app/client/models/entities/ColumnRec';
import {ObjObservable} from 'app/client/models/modelUtil';
import {dropdownWithSearch} from 'app/client/ui/searchDropdown';
import {cssIcon, cssRow, cssSortFilterColumn} from 'app/client/ui/RightPanelStyles';
@@ -215,7 +216,7 @@ export class SortConfig extends Disposable {
const currentSection = this._section;
const currentSortSpec = use(currentSection.activeSortSpec);
const specRowIds = new Set(currentSortSpec.map(_sortRef => Sort.getColRef(_sortRef)));
return use(columns).filter(_col => !specRowIds.has(_col.value));
return use(columns).filter(_col => !specRowIds.has(_col.value)).sort(labelsOrder);
});
const {menuOptions} = this._options;
return cssButtonRow(