单击图标时,仅需要按升序对物料数据表进行排序。我不需要按降序排序。如何使用Angular材质数据表实现它?
答案 0 :(得分:0)
您可以设置默认排序选项,并在MatSort api上使用排序功能来设置该默认选项。 table-sorting-example
defaultSort: MatSortable = {
id: 'defColumnName',
start: 'asc',
disableClear: true
};
然后在MatSort指令上使用排序功能:
this.sort.sort(this.defaultSort);
//default sort direction
this.sort.direction = 'asc';