Angular 清除 table 问题的 editable 字段
Angular clear editable fields of table problem
我有问题。当我想向 table 添加新行时。它清除所有以前的行。
这样我就可以推送新的空元素。
testFunc()
{
//console.log(this.ProcessVATElems[this.elemIter].Lp);
this.ProcessVATElems[this.elemIter].Lp = ++this.elemIter;
var elem = new ProcessVatElement()
elem.Lp = 0;
this.ProcessVATElems.push(elem);
console.log(this.ProcessVATElems);
console.log(this.elemIter);
}
这是我在 html
中绑定的示例
<td>
<input type="text" class="form-control smallOpt" name="att23" [(ngModel)]="ProcessVATElems[index].NetValue"
[disabled]="End" id="Dom" placeholder="" style="width:50pt; height: 22pt; margin-left: 1pt;">
</td>
这是我在添加新行之前 table。
然后(我通过调用 testFunc() 添加新行)
要添加新行,我单击 table 元素,其中 Lp == 0
<td (click)="testFunc()" >
{{elem.Lp}}
</td>
每个输入都需要一个唯一的名称
[name]="'att23_' + index"
我有问题。当我想向 table 添加新行时。它清除所有以前的行。
这样我就可以推送新的空元素。
testFunc()
{
//console.log(this.ProcessVATElems[this.elemIter].Lp);
this.ProcessVATElems[this.elemIter].Lp = ++this.elemIter;
var elem = new ProcessVatElement()
elem.Lp = 0;
this.ProcessVATElems.push(elem);
console.log(this.ProcessVATElems);
console.log(this.elemIter);
}
这是我在 html
中绑定的示例 <td>
<input type="text" class="form-control smallOpt" name="att23" [(ngModel)]="ProcessVATElems[index].NetValue"
[disabled]="End" id="Dom" placeholder="" style="width:50pt; height: 22pt; margin-left: 1pt;">
</td>
这是我在添加新行之前 table。
然后(我通过调用 testFunc() 添加新行)
要添加新行,我单击 table 元素,其中 Lp == 0
<td (click)="testFunc()" >
{{elem.Lp}}
</td>
每个输入都需要一个唯一的名称
[name]="'att23_' + index"