mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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:
@@ -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
|
||||
},
|
||||
|
Reference in New Issue
Block a user