[ACA-3542] - added sorting for filters (#5932)

* [ACA-3542] - added sorting for filters

* [ACA-3542] - removed wrong parameter

* [ACA-3542] - fixed test with fixed sorting mode parameter

* Update content-node-selector-panel.component.html

* fix e2e

* fix delete site

Co-authored-by: Eugenio Romano <eromano@users.noreply.github.com>
Co-authored-by: Eugenio Romano <eugenio.romano@alfresco.com>
This commit is contained in:
Vito
2020-08-03 10:30:14 +01:00
committed by GitHub
parent bfbb66ea8e
commit 85183ead0d
25 changed files with 114 additions and 27 deletions

View File

@@ -543,11 +543,11 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
const current = this.data.getSorting();
let newDirection = 'asc';
if (current && column.key === current.key) {
newDirection = current.direction === 'asc' ? 'desc' : 'asc';
newDirection = current.direction?.toLowerCase() === 'asc' ? 'desc' : 'asc';
}
this.sorting = [column.key, newDirection];
this.data.setSorting(new DataSorting(column.key, newDirection));
this.emitSortingChangedEvent(column.sortingKey, newDirection);
this.emitSortingChangedEvent(column.key, column.sortingKey, newDirection);
}
this.keyManager.updateActiveItem(0);
@@ -639,7 +639,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
isColumnSorted(col: DataColumn, direction: string): boolean {
if (col && direction) {
const sorting = this.data.getSorting();
return sorting && sorting.key === col.key && sorting.direction === direction;
return sorting && sorting.key === col.key && sorting.direction.toLocaleLowerCase() === direction;
}
return false;
}
@@ -771,9 +771,10 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
this.elementRef.nativeElement.dispatchEvent(domEvent);
}
private emitSortingChangedEvent(key: string, direction: string) {
private emitSortingChangedEvent(column: string, key: string, direction: string) {
const domEvent = new CustomEvent('sorting-changed', {
detail: {
column,
key,
direction
},