I'm having a very weird problem in my Angular 2 application using the PrimeNG DataTable. It's possible to change data in my DataTable, using the [editable]"true"
syntax.
The data in the DataTable is called = inschrijvingen
.
I'm doing this.originalInschrijvingen = this.inschrijvingen
to create a 'copy' before the user can change the data so I can compare the changes in a later stage. But for some reason is the DataTable data binding to both originalInschrijvingen
and inschrijvingen
.
Here is my code:
onRowSelectUser(event) { //This is a different DataTable than the editable DataTable
this.getGebruikerZijnInschrijvingen(res => {
this.createRoleID(res => {
let selectedIds = this.gebruikerZijnInschrijvingen.map(it => it.DefUnitID);
this.selectedInschrijvingen = this.inschrijvingen.filter(inv => selectedIds.indexOf(inv.ID) != -1);
this.originalInschrijvingen = this.selectedInschrijvingen;
})
})
}