关于打字稿:如何在Angular-4的ng2-table中添加复选框?

How to add checkbox in ng2-table in Angular-4?

我需要在我们使用ng2-table的Angular 4打字稿中添加复选框。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//code for ng-table in html
<ng-table (tableChanged)="onChangeTable(config)"
(cellClicked)="onCellClick($event)"
[rows]="rows" [columns]="columns">
</ng-table>

//to create checkbox I am adding html in component where filling the data.
data.forEach((item: any) =>
{item.CheckBox = '<input type="checkbox"></input>';

//cell click event in table component is getting triggered
public onCellClick(data: any): any {
     this event is getting triggered
     ....
}
  • UI上的复选框已禁用或无法选中。
    我认为某些事件正在触发并将所选值恢复为false
    每一次。 如何预防呢?
  • 我在哪里将此复选框绑定到ng-model或类似模型?
  • 请帮忙。 谢谢。


    您的数据在哪里绑定到表? 复选框的模板在哪里? 您可以在stackblitz仓库中重新创建问题吗?

    顺便说一句,官方回购问题中有一个关于复选框的主题