ngx-datatable formArray remove row, desynchronized table values
See original GitHub issueI’m submitting a …
[x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter
Current behavior I have a ngx-datatable in binding with a formarray and the single cell are constructed with ng-template ngx-datatable-cell-template.
When I remove one item from the datable and the underline formarray with the follow code, the table became desynchronised.
The form control show a different value respect the underline formgroup.
Expected behavior
When removing item from the table, the column with in binding formcontrol not became desincronized.
Reproduction of the problem
Code deleting the row
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);
}
- Browser: Chrome 67.0
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:11
Top Results From Across the Web
Remove rows with ngx-datatable - angular - Stack Overflow
Your stacklitz example show how to remove first row with different sites names. I want to keep all my elements with "Site1" as...
Read more >is_array javascript Code Example - Code Grepper
let names=['Jhon','David','Mark']; console.log(Array.isArray(names)); // true let user={id:1,name:'David'}; console.log(Array.isArray(user)); // false let ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
also found out: if i leave the route and return, the values get updated to the correct thing. testing this further, i set a boolean variable
test
in my component, and set anngIf
on the fields that are desynced. if i remove the row, it becomes desynced, but then if i toggle thetest
variable, it will resync back.Angular 7.0.4
do we have any alternative for this?? i’m facing the same issue when deleting first row it always delete the last one.