Add the "delete flight" in the table
This commit is contained in:
@@ -68,6 +68,14 @@
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef style="min-width: 80px;"></th>
|
||||
<td mat-cell *matCellDef="let element" style="text-align: left;">
|
||||
<mat-icon aria-hidden="false" aria-label="Delete this jump" style="cursor: pointer;"
|
||||
(click)='delete(element)'>delete</mat-icon>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
|
||||
@@ -203,4 +203,12 @@ export class ListOfTunnelFlightsComponent implements OnInit {
|
||||
|
||||
return beginDate;
|
||||
}
|
||||
|
||||
public delete(item: TunnelFlight) {
|
||||
let data: Array<TunnelFlight> = this.dataSourceTable.data;
|
||||
data = data.filter((d) => d.id !== item.id);
|
||||
|
||||
this.dataSourceTable.data = data;
|
||||
this.serviceTunnelFlight.deleteTunnelFlight(item);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user