Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Angular-4中的ng2表中添加复选框?_Angular_Typescript_Checkbox_Ng2 Smart Table - Fatal编程技术网

如何在Angular-4中的ng2表中添加复选框?

如何在Angular-4中的ng2表中添加复选框?,angular,typescript,checkbox,ng2-smart-table,Angular,Typescript,Checkbox,Ng2 Smart Table,我需要在Angular 4 typescript中添加复选框,我们正在使用ng2表 //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 ht

我需要在Angular 4 typescript中添加复选框,我们正在使用ng2表

//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
     ....
}
//html中ng表的代码
//为了创建复选框,我在填充数据的组件中添加了html。
data.forEach((项目:任何)=>
{item.CheckBox='';
//正在触发表组件中的单元格单击事件
public onCellClick(数据:任意):任意{
此事件正在被触发
....
}
  • UI上的复选框已禁用或无法选中。 我认为某些事件被触发,并将所选值恢复为false 每一次。如何预防
  • 在何处将此复选框绑定到ng型号或类似型号

  • 请帮助。谢谢。

    您的数据绑定到表中的位置在哪里?复选框的模板在哪里?您可以在回购中重新创建问题吗


    顺便说一句,感谢您的回复,

    中有一个关于复选框的线程。它不是常规的复选框。它包含在ng2表中。我可以触发单元格单击事件。但是,该复选框在UI中被禁用。还可以查看您提供的链接。您能提供一个“请”吗?例如,我已经编辑了我的问题并添加了more详细信息。如果您能提供帮助。谢谢。谢谢您的回复。问题已经解决。在cellClick事件中,我们能够添加动态基本html代码。这已经解决了问题。