【发布时间】:2020-04-05 12:40:52
【问题描述】:
我正在使用一个普通的 (Bootstrap) 表,我希望在该表上放置可排序的行。我正在使用 Angular CDK (DragDropModule) 来实现排序/排序。但是,当行被拖动时,它会扭曲宽度,因为 cdkDragPreview(tr 元素)现在位于表格之外,附加到正文,因此它具有不同的display 样式并且列宽与原始表即使是display:table。
这是粗略的 html:
<table>
<thead>
<tr>
<th><i class="fas fa-sort mt-1"></i></th>
<th>Code</th>
<th>Name</th>
<th>Date Type</th>
</tr>
</thead>
<tbody cdkDropList (cdkDropListDropped)="drop($event)">
<tr *ngFor="let date of dates" cdkDrag>
<td cdkDragHandle><i class="fas fa-sort mt-1"></i></td>
<td>{{ date.code }}</td>
<td>{{ date.name }}</td>
<td>{{ date.dateType }}</td>
</tr>
</tbody>
</table>
如何让拖动/排序“看起来不错”?
【问题讨论】:
标签: angular angular-cdk