关闭多个对话框

时间:2014-09-23 15:13:31

标签: sapui5

如果我打开两个对话框

dialogBusy = new sap.m.BusyDialog();
dialogBusy.setShowCancelButton(true);
dialogBusy.setTitle("1");
dialogBusy.open();

dialogBusy = new sap.m.BusyDialog();
dialogBusy.setShowCancelButton(true);
dialogBusy.setTitle("2");
dialogBusy.open();

dialogBusy.close();

//dialogBusy.close();

当我调用close函数时,我只关闭第二个对话框(正确)。 如何关闭所有对话框?

2 个答案:

答案 0 :(得分:1)

使用sap/m/InstanceManager.closeAllDialogs可以方便地关闭对话框。

Map.merge/3

答案 1 :(得分:0)

使用两个不同的对话框实例。



<script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-libs="sap.m,sap.ui.commons"></script>
<script>
    var dialogBusy = new sap.m.BusyDialog();
    dialogBusy.setShowCancelButton(true);
    dialogBusy.setTitle("1");
    dialogBusy.open();

    var dialogBusy2 = new sap.m.BusyDialog();
    dialogBusy2.setShowCancelButton(true);
    dialogBusy2.setTitle("2");
    dialogBusy2.open();
    setTimeout(function() {
        dialogBusy.close();
    }, 2000);
    setTimeout(function() {
        dialogBusy2.close();
    }, 1000);
</script>
&#13;
&#13;
&#13;