I am trying to add custom action "Copy" in Ng2SmartTable Grid. I am facing issue with click event handler of custom action. There are 3 buttons in grid Edit,Delete,Copy. Edit ,Delete is working fine. But 'Copy' method is not getting fired onclick of copy button.
Grid.component.html code
<ng2-smart-table [settings]="settings" (custom)="onCustom($event)" [source]="source" (edit)="onEdit($event)" (delete)="onDelete($event)"></ng2-smart-table>
OnEdit ,OnDelete working fine But OnCustom not working.
Grid.component.ts file code for settings for ng2smarttable.
mode: 'external',
actions: {
add: false,
custom: [{
name: 'copy', title: 'Copy'
}]
},
onCustom method not working at all.
There must be an issue with the function in your component, the code you have shared in your question is setup correctly and works in this stackblitz.
Please note: when the copy button is clicked the event is passed to the onCustom function in the app.component.ts and logs the event in the console.
https://stackblitz.com/edit/smarttable-e8gqql?embed=1&file=app/app.component.ts