自定义操作方法在 ng2 智能表中不起作用



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

网格组件.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'
}]
},

自定义方法根本不起作用。

您的组件中的函数一定有问题,您在问题中共享的代码设置正确并在此堆栈闪电战中工作。

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

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

最新更新