Open modal dialog through JavaScript Oracle APEX

前端 未结 2 1995
攒了一身酷
攒了一身酷 2021-01-03 09:50

I am trying to open a modal dialog page through a JavaScript redirect URL.

My code is like this:

$(\'#Subnet tr\').each(function (i, row){
        va         


        
相关标签:
2条回答
  • 2021-01-03 10:15

    This would also be a working solution (slightly different).

    Please note the call the apex.navigation.redirect to actually OPEN the dialog page.

    function editAgenda (p_agenda_id) {
    l_url = 'f?p=#APP_ID#:72:#SESSION#::NO:RP,72:P72_AGENDA_ID:#AGENDA_ID#';
    
    l_url = l_url.replace('#APP_ID#',    $v('pFlowId'));
    l_url = l_url.replace('#SESSION#',   $v('pInstance'));
    l_url = l_url.replace('#AGENDA_ID#', p_agenda_id);
    
    // execute PL/SQL API apex_uti.prepare_url to generate a valid Session State Protection checksum
    apex.server.process(    
        'editAgendaDA',
        {x01: l_url},
        {success: function (pData) {           
                console.log(pData);
                // Call Modal Dialog Page
                apex.navigation.redirect(pData);
            },
            dataType: "text"                     
        }
      );
    

    }

    -- Process editAgendaDA (in Ajax Callback)

    declare
        l_url varchar2(2000);   
        v_result varchar2(4000);
    begin
        v_result := apex_util.prepare_url(apex_application.g_x01);
        htp.prn(v_result);
    end;
    
    0 讨论(0)
  • 2021-01-03 10:19

    You should use a Page Process to calculate an URL. This could be an Ajax Process:

    DECLARE
        l_url varchar2(2000);
        l_app number := v('APP_ID');
        l_session number := v('APP_SESSION');
    
        l_item_name VARCHAR2(2000) := 'P27_XYZ';
    BEGIN
        l_url := APEX_UTIL.PREPARE_URL(
            p_url => 'f?p=' || l_app || ':'||apex_application.g_x01||':'||l_session||'::NO::'||l_item_name||':'||apex_application.g_x02,
            p_checksum_type => 'SESSION');
        htp.p(l_url);
    END;
    

    Call that with this Javascript:

    apex.server.process(
        'PREPARE_URL',                           
        {
            x01: 27, 
            x02: 'myvalue'
        }, 
        {
            success: function (pData)
            {           
                console.log(pData);
            },
            dataType: "text"                     
        }
    );
    

    You will get a javascript code back, and you need to call that. It'll calculate the correct Checksum and you can open the Dialog perfectly.

    0 讨论(0)
提交回复
热议问题