Default sorting in Angular Material - Sort header

后端 未结 9 1340
执念已碎
执念已碎 2020-12-13 03:14

How can I change Angular Material code below, so that data-table is sorted by \'name\' column, ascending order by default. Arrow (indicating current sort direction) must be

9条回答
  •  独厮守ぢ
    2020-12-13 03:45

    In my case sorting was not working because matColumDef id and mat-cell var is different

    
       First Name
       {{ item.name}}
    
    

    after making changes matColumnDef="firstName" to matColumnDef="name" which is same as item.name

        
       First Name
       {{ item.name}}
    
    

    it works fine for me

提交回复
热议问题