[英]Angular Material table drag and drop columns with sorting not wroking
The angular material table with sorting doesn't work properly with drag-and-drop.带排序的角度材料表无法通过拖放正常工作。
Here's what I've got so far, it kinda works where the sorting works with a specific column after being dragged and dropped.这是我到目前为止所得到的,它有点适用于在拖放后排序与特定列一起工作的地方。 But still has weird functionality.但仍然有奇怪的功能。
I want to be able to use the normal sorting functionality of Material Table while being able to drag and drop columns.我希望能够使用材料表的正常排序功能,同时能够拖放列。
matSort
needs to be on the mat-table
element matSort
需要在mat-table
元素上
<mat-table [dataSource]="dataSource" class="mat-elevation-z8" cdkDropListGroup matSort>
rather than on the ng-container
而不是在ng-container
上
<mat-table [dataSource]="dataSource" class="mat-elevation-z8" cdkDropListGroup>
<ng-container *ngFor="let column of columns; let i = index" [matColumnDef]="column.field" matSort>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.