Is there a way to sort all columns in an Angular material table by descending order, while keeping the active column sorted in ascending order?
I have been trying to achieve this using the code below:
@ViewChild(MatSort) sort: MatSort;
<table matSort matSortActive="orderColumn">
this.dataSource.sort = this.sort;
const sortState: Sort = {active: 'orderColumn', direction: 'desc'};
this.sort.active = sortState.active;
this.sort.direction = 'desc';
this.sort.sortChange.emit(sortState);
I found this approach from a helpful answer on Stack Overflow, but unfortunately, it is not working as expected.
Your assistance is greatly appreciated!