我有一张表,它的值来自tablesValue
.
<p-table [value]="tablesValue">
我需要支持“删除用户可以在桌面上进行的所有更改”。所以一开始我复制tablesValue
到tablesValueBackup
. 当用户单击按钮时,我会显示一个对话框:
<p-confirmDialog header="Confirmation" icon="pi pi-exclamation-triangle"></p-confirmDialog>
在 ts 中,我这样做:
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);
}
});
}
为什么当我单击确认按钮中的接受按钮时,表格未在 UI 中更新,但在console.log
其中打印正确的值?