我在同一个HTML页面上有两个这样的标记,它的 <ngx-datatable>
行单元格 .
<ngx-datatable class="material striped"
[rows]="new"
[columns]="columns"
[columnMode]="'force'"
[headerHeight]="80"
[loadingIndicator]="loadingIndicator"
[targetMarkerTemplate]="targetMarkerTemplate">
<ngx-datatable-column class="gridcolm">
<ng-template *ngIf="col.name == 'rates' || col.label == 'rates'"
ngx-datatable-cell-template let-rowIndex="rowIndex" let-value="value"
let-row="row" let-group="group" let-rowHeight="rowHeight">
<input autofocus (change)="getValue($event.target.value, rowIndex)"
type="text" [value]="value" /></ng-template>
<ng-template *ngIf="col.name == 'price' || col.label == 'price'"
ngx-datatable-cell-template let-rowIndex="rowIndex" let-value="value"
let-row="row" let-group="group" let-rowHeight="rowHeight">
<span>{{curvalue}}</span>
</ng-template>
</ngx-datatable-column>
</ngx-datatable>
我想如果有人在费率字段上输入值,则相应的价格字段会自动更新 .
这是我的代码
getValue(valuess, rowIndex) {
this.curvalue=[];
this.curvalue[rowIndex] = {};
if (valuess == null) {
this.curvalue="";
} else {
this.curvalue[rowIndex] = valuess-this.trade;
}
}
但它没有更新相应的行索引(例如0),而是更新每个价格值 .
请帮忙