mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-16 23:40:14 +01:00
feat(table): confirm before delete
This commit is contained in:
parent
bfab17bd43
commit
cbef8bf658
2 changed files with 10 additions and 1 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue