mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-17 07:50:12 +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: {
|
delete: {
|
||||||
deleteButtonContent: '<i class="ion-trash-a"></i>',
|
deleteButtonContent: '<i class="ion-trash-a"></i>',
|
||||||
|
confirmDelete: true
|
||||||
},
|
},
|
||||||
columns: {
|
columns: {
|
||||||
id: {
|
id: {
|
||||||
|
|
@ -66,4 +67,12 @@ export class SmartTables {
|
||||||
this.source.load(data);
|
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">
|
<div class="row">
|
||||||
<ba-card title="Basic Example" baCardClass="with-scroll">
|
<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>
|
</ba-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue