I have a table which take its values from tablesValue
.
<p-table [value]="tablesValue">
I need to support "delete all change that the user can do on table". So at start I copy the tablesValue
into tablesValueBackup
. When the user clicks on a button, I show a dialog:
<p-confirmDialog header="Confirmation" icon="pi pi-exclamation-triangle"></p-confirmDialog>
In ts, I do:
click(){
let tablesValue=this.tablesValue;
let tablesValueBackup=this.tablesValueBackup;
this.confirmationService.confirm({
message: 'Delete all change',
accept: () => {
//the problem is here because the table is not update
tablesValue= tablesValueBackup;
console.log(tablesValue);
}
});
}
Why when I click on accept button in confirm button, the table is not updated in UI but in console.log
it prints the correct value?