Ajout de la possibilité de supprimer un saut

Ajout de la possibilité de ne pas reset le
formulaire après ajout de sauts
This commit is contained in:
Sébastien André
2021-04-20 10:38:05 +02:00
parent 27928f1696
commit 49c2a87423
5 changed files with 64 additions and 44 deletions

View File

@@ -50,6 +50,14 @@
<td mat-cell *matCellDef="let element">{{element.gear.name}}</td>
</ng-container>
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef></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>

View File

@@ -22,7 +22,8 @@ export class ListOfJumpsComponent implements OnInit {
'jumpDate',
'jumpType',
'aircraft',
'dropZone'
'dropZone',
'actions'
];
public dataSourceTable;
public resultsLength = 0;
@@ -51,11 +52,15 @@ export class ListOfJumpsComponent implements OnInit {
openDialog(item: JumpResp) {
this.dialog.open(JumpInfosComponent, {
data: item //,
// position: {
// top: '0px',
// left: '0px'
// }
data: item
});
}
delete(item: JumpResp) {
let data : Array<JumpResp> = this.dataSourceTable.data;
data = data.filter(d => d.id !== item.id);
this.dataSourceTable.data = data;
this.serviceApi.DeleteJump(item);
}
}