Как перетащить данные столбца и строки в таблицу материалов? - PullRequest
0 голосов
/ 08 февраля 2020

Я попытался перетащить данные столбца и строки в таблицу материалов. Я могу перетаскивать данные столбца или строки отдельно. Если я попытаюсь перетащить данные столбца и строки в таблицу материалов, я не смогу этого добиться. Как добиться перетаскивания данных столбца и строки в таблице материалов?

<mat-table #table [dataSource]="dataSource" class="mat-elevation-z8"
 #list2="cdkDropList" cdkDropList [cdkDropListData]="dataSource.data" cdkDropListGroup   (cdkDropListDropped)="dropTable($event)">
  <ng-container *ngFor="let column of columns; let i = index" [matColumnDef]="column.field">
    <mat-header-cell *matHeaderCellDef
      cdkDropList
      cdkDropListLockAxis="x"
      cdkDropListOrientation="horizontal"
      (cdkDropListDropped)="dropListDropped($event, i)"
      cdkDrag
      (cdkDragStarted)="dragStarted($event, i)"
      [cdkDragData]="{name: column.field, columIndex: i}" >
      {{ column.field }}
    </mat-header-cell>
    <mat-cell *matCellDef="let row"> {{ row[column.field] }}  </mat-cell>
  </ng-container>
  <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
  <mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row> 
</mat-table>

https://stackblitz.com/edit/angular-xgwy55?file=src / app / app.component. html

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...