feat(table): confirm before delete

This commit is contained in:
nixa 2016-08-23 14:14:35 +03:00
parent bfab17bd43
commit cbef8bf658
2 changed files with 10 additions and 1 deletions

View file

@ -30,6 +30,7 @@ export class SmartTables {
},
delete: {
deleteButtonContent: '<i class="ion-trash-a"></i>',
confirmDelete: true
},
columns: {
id: {
@ -66,4 +67,12 @@ export class SmartTables {
this.source.load(data);
});
}
onDeleteConfirm(event): void {
if (window.confirm('Are you sure you want to delete?')) {
event.confirm.resolve();
} else {
event.confirm.reject();
}
}
}

View file

@ -2,7 +2,7 @@
<div class="row">
<ba-card title="Basic Example" baCardClass="with-scroll">
<ng2-smart-table [settings]="settings" [source]="source"></ng2-smart-table>
<ng2-smart-table [settings]="settings" [source]="source" (deleteConfirm)="onDeleteConfirm($event)"></ng2-smart-table>
</ba-card>
</div>