【发布时间】:2018-02-12 14:14:11
【问题描述】:
我需要移动表格的列,但我不知道该使用哪个组件或如何实现它,您能否推荐一个以及如何操作?
基本上这是我的component.html
<form>
<table class="table-fixed">
<thead>
<tr>
<th *ngIf="selectionMode == 'multi'" class="checkbox">
<mat-checkbox (change)="onChangeSelectionAll($event)">
</mat-checkbox>
</th>
<th *ngFor="let column of columns" class="pointer" (click)="sort(column)">{{column.label}}
</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let node of data">
<td>
<mat-checkbox [checked]="node.isSelected" name="node.id" (change)="onChangeSelection($event, node)" [ngClass]="node.isFiltered ? 'filtered' : ''">
</mat-checkbox>
</td>
<td *ngIf="showIcon" class="icon" (click)="onClicked($event, node)">
<i class="icon-{{node.data.iconname ? node.data.iconname.toLowerCase().replace('.png', '') : ''}}" height="24"></i>
</td>
<td *ngIf="showStatus" class="icon">
<i *ngIf="node.tooltip !== '<ul></ul>'" tooltip-delay="300" tooltip='{{ node.tooltip }}' tooltip-position="right" class="material-icons {{node.icon_class}}"
height="24">{{node.icon}}</i>
<i *ngIf="node.tooltip === '<ul></ul>'" class="material-icons {{node.icon_class}}" height="24">{{node.icon}}</i>
</td>
<td *ngFor="let column of columns" class="{{(node.normalizedError && node.normalizedError[column.id]) ? 'error' : 'normal'}}"
tooltip="{{(node.normalizedError && node.normalizedError[column.id]) ? node.normalizedError[column.id] : false}}"
tooltip-delay="300" tooltip-position="below" tooltipDisabled="{{(node.normalizedError && node.normalizedError[column.id]) ? false : true}}"
(click)="onClicked($event, node)" [innerHTML]="node.normalizedData[column.name.toLowerCase()] ? node.normalizedData[column.name.toLowerCase()] : ''"></td>
</tr>
</tbody>
<!--</div>-->
</table>
</form>
如何移动列?
【问题讨论】:
-
我在这里找到了答案:stackoverflow.com/questions/56236058/…给男人一些爱。
标签: angular drag-and-drop