[ACA-4313] - Sort order doesn't work correctly (#8892)

[ACA-4313] - Sort order doesn't work correctly
This commit is contained in:
DominikIwanek
2023-09-12 16:07:16 +02:00
committed by GitHub
parent 13b6bf37ff
commit e14e489d2d
2 changed files with 8 additions and 1 deletions

View File

@@ -742,7 +742,7 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges,
isColumnSorted(col: DataColumn, direction: string): boolean {
if (col && direction) {
const sorting = this.data.getSorting();
return sorting && sorting.key === col.key && sorting.direction.toLocaleLowerCase() === direction;
return this.isSortingEqual(col, direction, sorting);
}
return false;
}
@@ -1018,6 +1018,12 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges,
this.columnsWidthChanged.emit(allColumns);
}
private isSortingEqual(col: DataColumn, direction: string, sorting: DataSorting): boolean {
return sorting &&
(sorting.key === col.key || sorting.key === col.sortingKey) &&
sorting.direction?.toLocaleLowerCase() === direction;
};
}
export interface DataTableDropEvent {