我正在实现一个对话框,它将打开一个弹出窗口,询问用户是否想要删除,立即下一步是询问评论。
对于第一个(询问是否要删除),代码很好。我使用了相同的方法在级联中实现了这一点,但是文件没有被删除。
代码如下:
deleteRow(i: any) {
this.dialogService
.openConfigDialog('Are you really want to delete this file ?')
.afterClosed()
.subscribe(async (res) => {
if (res) {
/* this.reason
.openReasonDialog("Please describe the reason for delete")
.afterClosed()
.subscribe(async (res) => {
if (res) { */
let deleteRowRequest = {
IstValues: [this.dataSource.data[i]]
};
this.istManagementService.deleteRecord(this.inputTable, deleteRowRequest).subscribe(
(res: any) => {
this.dataSource.data.splice(i, 1);
this.dataSource._updateChangeSubscription();
}
)
/* }}) */
}
}
)
}
refresh(): void { window.location.reload()}如果我注释掉,这些文件就会被删除。如果我不评论,它们不会被删除。
发布于 2021-09-24 06:11:24
很难共享所有的代码,因为我的对话框在一个库中,它们被一个服务调用,但我做了一个快速测试,它是这样的。
dialogNotify() {
let data2: IDialogNotify = {
title: 'Toolbar Menu',
warning: 'Toolbar Menu',
message1: 'The menu toolbar will show...',
message2: 'NOTICE - When making changes to blah blah.' +
' ... depending on the processing power of your device. Check the Messages indicator on the top right' +
' of the screen.',
confirmButton: 'Ok, I got it',
};
this.dialogService.openNotify(data2);
this.dialogService.openNotifyConfirmed().subscribe((confirmed: any) => {
if (confirmed) {
let data2: IDialogNotify = {
title: 'Toolbar Menu',
warning: 'Toolbar Menu',
message1: "error",
message2: "",
confirmButton: 'Ok, I got it',
};
this.dialogService.openNotify(data2);
this.dialogService.openNotifyConfirmed().subscribe((confirmed: any) => {
if (confirmed) {
this.logger.info('Confirmed: nested dialog');
}
});
}
});
}不知道这是否对你有帮助,但它确实起作用了。你确定你得到的第二个值是真的吗?
发布于 2021-09-27 14:34:23
我把(click)关闭放在对话框关闭的同一行。
重新定位到关闭窗口后,它解决了我的问题。
https://stackoverflow.com/questions/69308741
复制相似问题