I want to sorting on multiple columns in a data table (Angular Material) where next sorting column will give me the result based on previous column sorting.
this.dataSource = new MatTableDataSource(yourData);
this.dataSource.sortingDataAccessor = (item, property) => {
switch(property) {
case 'project.isActive': return item.project.isActive;
case 'project.start': return item.project.start;
default: return item[property];
}
};
this.dataSource.sort = sort;
Every time when I am sorting one column, it clears the previously sorted data.