I am having a interactive grid in oracle apex. One of the column is a pop up lov type. when the user changes the value in this column, it has to open a page and pass the row id of that particular cell. I tried the below JavaScript.
var ig = apex.region("your_grid_region_static_id").widget().interactiveGrid("getViews", "grid").model;
var selectedRecords = apex.region("your_grid_region_static_id").widget().interactiveGrid("getSelectedRecords");
// If a row is selected
if (selectedRecords.length > 0) {
var record = selectedRecords[0];
var rowId = ig.getValue(record, "ROW_ID"); // Replace ROW_ID with the column name in your IG that holds the row id
// Redirect to page 82 and pass the ROW_ID as a parameter (P82_ID)
window.location.href = apex.util.makeApplicationUrl({pageId: 82}) + '&P82_ID=' + rowId;
} else {
alert("Please select a row.");
}
I am not able to open the page with above code.
I can open the page with this code
window.location.href = apex.util.makeApplicationUrl({pageId: 82}) + '&P82_ID='
but unable to pass the row id.
Any help would be great full.
2
Answers
Use the URL constructor
Where did you find that API apex.util.makeApplicationUrl ? The official documentation does not list it which means it’s most probably not supported. AFAIK an apex url cannot be constructed in javascript with proper security since the checksum needs to be generated on the serverside. As a workaround you could create a callback process that generates the url using
apex_page.get_url
and invoke that process in javascript usingapex.server.process
.An alternative would be to just submit the page and use a branch. In the dynamic action using
apex.page.submit()
and branch to page 82. Set a page item on your current page to the id that you need to redirect to and use the url builder of the branch to set it on page 82.