首页 > 解决方案 > 在 Apex 5.0 中关闭模式对话框页面之前的确认

问题描述

当使用 (X) 按钮关闭模式对话框页面时,我正在尝试创建一个简单的确认(“您要关闭此窗口吗?”)。

在 Apex 5.0 中实现这一点的最有效方法是什么?

我尝试使用对话框关闭事件来实现解决方案,但这似乎对使用 (X) 按钮关闭对话框没有任何影响。

标签: oracleoracle-apexoracle-apex-5

解决方案


尝试在页面加载时使用该代码在模式页面中创建动态操作:

你的 da 应该执行一个 javascript 代码:

var button = parent.$('.ui-dialog-titlebar-close'); //get the button
button.unbind(); //remove the behavior

//put another behavior to the button
button.on('click', function() {
   apex.message.confirm( "Your message here", function( okPressed ) { 
      if( okPressed ) {
          apex.navigation.dialog.cancel(true);
      }
   });
});

尝试确认“X”按钮是否具有 css 类“ui-dialog-titlebar-close”,它们可以在 apex 版本之间更改。如有必要,使用正确的类更新代码的第一行。


推荐阅读