【发布时间】:2019-04-21 23:30:03
【问题描述】:
Angular 7 带来了强大的 DragDropModule:https://material.angular.io/cdk/drag-drop/examples
文档涉及重新排列列表中的项目或在多个列表之间转移项目。但是,它没有谈论表格。
我想知道是否有一种舒适的方法可以使用 angular material 的拖放系统来重新排序 mat-table 或 cdk-table 中的行。
(您可以将cdkDropList 添加到mat-table,这使机制工作,但没有所有花哨的动画和默认的拖动占位符。)
是否存在类似于通过拖放对表格行进行排序的易于实现的默认设置?
【问题讨论】:
-
您描述了该机制正在工作。对我来说,使用实际的角度 7.1 不起作用。当我将 cdkDropList 添加到 mat-table 时,我总是收到 Uncaught TypeError: Cannot read property 'clientRect' of undefined.
标签: angular drag-and-drop angular-material mat-table