我在 ngx-data-table 里面有输入字段,当用户更新输入字段的值时,另一个输入字段值需要是 auto 字段。下面是我的第一个输入字段的代码
<ng-template *ngIf="col.name == 'comment' || col.label == 'comment'"
ngx-datatable-cell-template let-rowIndex="rowIndex" let-value="value" let-row="row"
let-group="group" let-rowHeight="rowHeight">
<input autofocus
(blur)="updateValue($event, 'comment', rowIndex)"
type="text"
name="comment"
[value]="value" />
</ng-template>
当用户在上面的输入字段上填充数据时,需要自动填充以下输入字段。
<ng-template *ngIf="col.name == 'discussion' || col.label == 'discussion'"
ngx-datatable-cell-template let-rowIndex="rowIndex" let-value="value" let row="row" >
<span [(ngModel)]="discussion">{{discussion}}</span>
</ng-template>
这是我的密码
updateValue(event, cell, rowIndex)
{
console.log('inline editing rowIndex', rowIndex)
this.editing[rowIndex + '-' + cell] = false;
this.rows[rowIndex][cell] = event.target.value;
this.discussion= [...this.rows];
console.log('UPDATED!', this.discussion[rowIndex][cell]);
}
此代码无法正常工作,给出错误“ERROR TypeError:无法设置未定义的属性'注释'”。
我想当用户更新输入字段的值时,另一个输入字段值需要是 auto 字段。
请帮助或以任何其他方式实现这一目标。