Skip to content

Commit

Permalink
Fixed #17090 - Table: aria-sort not updated when sorting multiple col…
Browse files Browse the repository at this point in the history
…umns
  • Loading branch information
mertsincan committed Dec 17, 2024
1 parent c80a024 commit 3fc8630
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/primeng/src/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3627,8 +3627,20 @@ export class SortableColumn implements OnInit, OnDestroy {
}

updateSortState() {
this.sorted = this.dt.isSorted(<string>this.field) as boolean;
this.sortOrder = this.sorted ? (this.dt.sortOrder === 1 ? 'ascending' : 'descending') : 'none';
let sorted = false;
let sortOrder = 0;

if (this.dt.sortMode === 'single') {
sorted = this.dt.isSorted(<string>this.field) as boolean;
sortOrder = this.dt.sortOrder;
} else if (this.dt.sortMode === 'multiple') {
const sortMeta = this.dt.getSortMeta(<string>this.field);
sorted = !!sortMeta;
sortOrder = sortMeta ? sortMeta.order : 0;
}

this.sorted = sorted;
this.sortOrder = sorted ? (sortOrder === 1 ? 'ascending' : 'descending') : 'none';
}

@HostListener('click', ['$event'])
Expand Down

0 comments on commit 3fc8630

Please sign in to comment.