Skip to content

Instantly share code, notes, and snippets.

@AlexanderKozhevin
Created May 7, 2017 11:10
Show Gist options
  • Save AlexanderKozhevin/a5c10d896d075926e8070bfbb275e1b5 to your computer and use it in GitHub Desktop.
Save AlexanderKozhevin/a5c10d896d075926e8070bfbb275e1b5 to your computer and use it in GitHub Desktop.
<ng2-smart-table
[settings]="content.tablesettings"
[source]="source"
(deleteConfirm)="onDeleteConfirm($event)"
(editConfirm)="onSaveConfirm($event)"
(createConfirm)="onCreateConfirm($event)"></ng2-smart-table>
source: LocalDataSource;
onDeleteConfirm(event) {
if (window.confirm('Are you sure you want to delete?')) {
event.confirm.resolve();
} else {
event.confirm.reject();
}
}
onSaveConfirm(event) {
if (window.confirm('Are you sure you want to save?')) {
event.newData['name'] += ' + added in code';
event.confirm.resolve(event.newData);
} else {
event.confirm.reject();
}
}
onCreateConfirm(event) {
if (window.confirm('Are you sure you want to create?')) {
event.newData['name'] += ' + added in code';
event.confirm.resolve(event.newData);
} else {
event.confirm.reject();
}
}
constructor(){
this.source = new LocalDataSource(Content.tabledata);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment