0
votes

In the Oracle APEX 19.1 documentation for JS API, it is mentioned that we can pass column Items in apex.server.process. How do we use that?

Im trying to send column item value to ajax callback function using apex.server.process

I tried the below codes

apex.server.process("ajax_1", { pageItems: ["ENAME"] }, {
    target: $("#EMP"), dataType: "text", success: function (pData) {
        alert(pData);
    }
});

And

apex.server.process("ajax_1", { pageItems: ["ENAME"] }, {
    target: "#EMP", dataType: "text", success: function (pData) {
        alert(pData);
    }
});

The grid has Static ID: EMP and has a column with name : ENAME and Static Id : ENAME

And in the Ajax Callback Process (PLSQL)

BEGIN
    htp.prn('ENAME : ' ||:ENAME);
END;

I get the following error

ERR-1002 Unable to find item ID for item "ENAME" in application "XXXXX"

Please help.

2
Most of the time items on the page will have an item ID like P1_ENAME. You need to use that. - Jeffrey Kemp

2 Answers

0
votes

In your Ajax Callback Process, you need to access the variables with the Syntax apex_application.g_x01 to apex_application.g_x10.

See https://docs.oracle.com/cd/E59726_01/doc.50/e39149/apex_app.htm#AEAPI214 for details and a small example.

0
votes

I am late, but since I had the same question, I wanted to submit the answer.

If your Javascript looks like this:

apex.server.process("test_ajax_variable",
        {
            x01: "Test",
            pageItems: "#P13_ITEM"
        },
        {
            dataType: 'text'
        });

You can access the variables in an APEX Process like so:

DECLARE
    l_test VARCHAR2(100);
BEGIN
    l_test := apex_application.g_x01 || ', ' || :P13_ITEM;
    htp.p(l_test);
END;