自定义操作方法在 ng2 smarttable 中不起作用

Custom action method not working in ng2 smarttable

我正在尝试在 Ng2SmartTable 网格中添加自定义操作 "Copy"。 我面临自定义操作的单击事件处理程序的问题。 grid 中有 3 个按钮 Edit,Delete,Copy。编辑,删除工作正常。但是 'Copy' 方法不会在单击复制按钮时触发。

Grid.component.html代码

  <ng2-smart-table [settings]="settings" (custom)="onCustom($event)" [source]="source" (edit)="onEdit($event)" (delete)="onDelete($event)"></ng2-smart-table>

OnEdit、OnDelete 工作正常但 OnCustom 不工作。

Grid.component.ts ng2smarttable 设置的文件代码。

  mode: 'external',
    actions: {
        add: false,
       custom: [{
            name: 'copy', title: 'Copy'
        }]
    },

onCustom 方法根本不起作用。

你的组件中的函数肯定有问题,你在问题中共享的代码设置正确并且可以在这个 stackblitz 中运行。

请注意:单击复制按钮时,事件将传递到 app.component.ts 中的 onCustom 函数,并在控制台中记录事件。

https://stackblitz.com/edit/smarttable-e8gqql?embed=1&file=app/app.component.ts