如何创建动态操作以便根据用户的选择页面是否重定向

How to create Dynamic Action so that according to user's choice page will or will not redirect

  1. 我有一个 Link 将用户重定向到 APEX 中的另一个页面。 Link 属性:

    class="new_test_run t-Button t-Button--simple t-Button--hot t-Button--stretch" 标题="Create Test Run" tc_id="#ID#"

  2. 还有 "Click" 事件,当用户点击提到 link 时 运行。

  3. 点击事件有动态动作。
  4. 当事件为真时,会有 "Confirm" 带有正确文本的操作。
  5. 最后是设置参数的"Execute JavaScript Code"动作:
    apex.confirm({
    request:"CREATE_TEST_RUN",
        set:{"P300_TEST_CYCLE_ID": $(this.triggeringElement).attr('tc_id')}
    });

I have come to new project and I need to take care of some APEX issues because nobody knows it. I was learning it few years ago so I am dedicated for it.

I was trying sonthing like this:

if (confirm { apex_util.redirect_url(p_url=>'f?p=110:309:&SESSION.::NO:RP::'); apex.confirm({ request:"CREATE_TEST_RUN", set:{"P300_TEST_CYCLE_ID": $(this.triggeringElement).attr('tc_id')} }); }

实际结果是: 无论对话框 window 中的用户 select "OK" 还是 "Cancel",页面都会被重定向。 预期结果是: 如果用户 select "Cancel" 对话框 window 应该关闭并且什么也不会发生。所以我试图找出如何在单击 "Cancel" 按钮时使用动态操作停止重定向。

在 Oracle 社区的一个人的帮助下,我已经解决了我的问题。如果以后有人遇到类似问题,我会与您分享解决方案。

在函数和全局变量声明部分创建如下函数:

function askNGo(pRedirLink){  
    console.log("Redir link: " + pRedirLink);  

    apex.message.confirm( "Are you sure?", function( okPressed ) {//message according to your needs  
    if( okPressed ) {  
        apex.navigation.redirect ( pRedirLink );  
    }  
});  
}  

在我的报告源中,我计算了一个(隐藏的)列,其中包含 Escape special characters=No,其中包含 link 到目标页面(请参阅 apex_page.get_url 函数的文档)

select col1, col2..., apex_page.get_url(p_page =>300, p_items => 'P300_TEST_CYCLE_ID', p_values => tcycle.id) create_new_ur from my_table;

目标应定义为:

接下来我编辑我的 link 如下:

类型:Link

Link 类型:URL

URL: javascript:askNGo("#CREATE_NEW_URL#");

Link 属性 -> class="new_test_run t-Button t-Button--simple t-Button--hot t-Button--stretch" title="Create Test Run" tc_id="#ID#" create_new_url="#CREATE_NEW_URL#"

最后我设置了 "Server-side Condition" Type = Never 用于动态操作。这样我没有删除它只是设置为不使用。