我有一个ngFor行和我什么时,我的一些细胞点击使其可编辑上点击表格单元格角2使其可编辑
<tr *ngFor="let invoice of invoiceItem.rows">
<td contenteditable='true' (input)="onRowClick($event, invoice.rowId)">{{ invoice.rowName }}</td>
<td>{{ invoice.hours}}</td>
<td>{{ invoice.price }}</td>
<td>{{ invoice.comments }}</td>
<td>{{ invoice.total}} </td>
</tr>
更过我如何处理新行支持其加入
<button (click)='addRow()'>Add a row</button>
addRow() {
this.invoiceItem.rows.push({
invoiceDetailsId: this.invoiceItem.item.invoiceId,
rowName: '',
hours: 0,
price: 0,
comments: '',
total: 0,
rowId:
})
}
onRowClick(event, id) {
console.log(event.target.outerText, id);
}
我应该为这项任务实施什么?
嘿!我不知道当我取消删除答案时是否收到通知。但请检查,有一个工作解决方案。 ) – Alex
好的检查,tnx – shaharnakash