mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ACA-4313] - Sort order doesn't work correctly (#8892)
[ACA-4313] - Sort order doesn't work correctly
This commit is contained in:
@@ -742,6 +742,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
|
|
||||||
onSortingChanged(event: CustomEvent) {
|
onSortingChanged(event: CustomEvent) {
|
||||||
this.orderBy = this.buildOrderByArray(event.detail.sortingKey, event.detail.direction);
|
this.orderBy = this.buildOrderByArray(event.detail.sortingKey, event.detail.direction);
|
||||||
|
this.sorting = [event.detail.sortingKey, event.detail.direction];
|
||||||
this.sortingSubject.next([this.additionalSorting, event.detail]);
|
this.sortingSubject.next([this.additionalSorting, event.detail]);
|
||||||
|
|
||||||
if (this.sortingMode === 'server') {
|
if (this.sortingMode === 'server') {
|
||||||
|
@@ -742,7 +742,7 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges,
|
|||||||
isColumnSorted(col: DataColumn, direction: string): boolean {
|
isColumnSorted(col: DataColumn, direction: string): boolean {
|
||||||
if (col && direction) {
|
if (col && direction) {
|
||||||
const sorting = this.data.getSorting();
|
const sorting = this.data.getSorting();
|
||||||
return sorting && sorting.key === col.key && sorting.direction.toLocaleLowerCase() === direction;
|
return this.isSortingEqual(col, direction, sorting);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1018,6 +1018,12 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges,
|
|||||||
|
|
||||||
this.columnsWidthChanged.emit(allColumns);
|
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 {
|
export interface DataTableDropEvent {
|
||||||
|
Reference in New Issue
Block a user