Issue
I have REST API that only supports ascending sort, is it possible to disable descending sort direction in MatTable but keep ascending direction and no sort option?
Solution
It's only override the function sort of the MatSort
@ViewChild(MatSort,{static:true}) sort: MatSort;
ngOnInit()
{
this.sort.sort=(sortable: MatSortable)=>{
if (this.sort.active != sortable.id) {
this.sort.active = sortable.id;
this.sort.direction = sortable.start ? sortable.start : this.sort.start;
} else {
this.sort.active=''
}
this.sort.sortChange.emit({active: this.sort.active, direction: this.sort.direction});
}
this.dataSource.sort=this.sort
}
Answered By - Eliseo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.