Angular Material表拖放列不排序 [英] Angular Material table drag and drop columns with sorting not wroking
本文介绍了Angular Material表拖放列不排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
具有排序功能的角度物料表无法通过拖放正常工作.
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
必须位于mat-table
元素上
<mat-table [dataSource]="dataSource" class="mat-elevation-z8" cdkDropListGroup matSort>
而不是在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>
这篇关于Angular Material表拖放列不排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文