Search code examples
angular6ng2-smart-table

Unable to get save data event in ng2-smart-table


I am using ng2-smart-table for maintain data in my angular 6 app. As I seen in it's git and npm page. I have set my code like this way.

<ng2-smart-table 
[settings]="settings" 
[source]="characters"
(createConfirm)="onCreateConfirm($event)">

I am able to load data in table by call API. But when I am not able to get save data event. For that I have set function like this.

onCreateConfirm(event) {
   alert("Clicked...");
}

I have set this function under the ngOnInit.


Solution

  • It's a common issue, you need to set in the configuration object the confirmCreate property, like this:

    export const settings= {
      delete: {
        confirmDelete: true,
        ...
      },
      add: {
        confirmCreate: true,
        ...
      },
      edit: {
        confirmSave: true,
        ...
      },
    ....