Disable 3rd state in Angular Material MatSortable

Adding the line Flignats mentioned, didn't work for me, so I had to add disableClear in the template, like:

<th mat-sort-header="firstName" disableClear>First name</th>

I hope this will help someone.


I'm a little unclear on your code, but it's something similar to this:

You have this on your component

@ViewChild(MatSort) sort: MatSort;

and

  ngOnInit() {
    ....
    this.dataSource.sort = this.sort;
  }

add this line after defining the sort

this.sort.disableClear = true;

Example Stackblitz