ngx-datatable formArray删除行,不同步的表值

时间:2018-07-12 13:35:51

标签: ngx-datatable formarray

我有一个与formarray绑定的ngx-datatable,并且单个单元格由ng-template构造。ngx-datatable-cell-template。

当我使用下面的代码从datable和下划线表单数组中删除一项时,表变得不同步了。

list of items before the remove

let index = this.datarows.indexOf(this.selected[0])
if (index>-1){                        
      this.datarows.splice(index,1);
      this.controls.removeAt(index);

      this.datarows = [...this.datarows];        
      this.controls.patchValue(this.datarows);     
}

list of items after removing line 35

列表显示为不同步,但是从表单组返回的值正确。

0 个答案:

没有答案