Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to access Popup LOV value from Interactive Grid using JavaScript (some JS help please!)

AmandaWalshAug 20 2021 — edited Aug 20 2021

I have a number of interactive grids on an APEX page (one for each day of the week) and I want to save the data from each into an APEX Collection. The IG_MON interactive grid contains 3 columns, their Static ID's are:
COL_MON_PROJECT
COL_MON_HOURS
COL_MON_DESCRIPTION
I have a Dynamic action (for each day) that runs some JavaScript that saves the IG data into page items:
P704_MON_PROJECT
P704_MON_HOURS
P704_MON_DESCRIPTION
(Then after the Javascript has run, I then call an Ajax Callback process to add_member to my APEX collection).
It is successfully working for the columns COL_MON_HOURS and COL_MON_DESCRIPTION as the Column Types are "Text Field".
For the COL_MON_PROJECT column, I have set this as a Popup LOV which shows "Project Name" for display, and an ID for the return value.
When I use my code below to save the COL_MON_PROJECT Popup LOV value, in the session state I can see P704_MON_PROJECT is shown as [object Object].
I have tried a few different options, but I am not proficient enough in JavaScript to get it quite right!

var col_project;
var col_hours;
var col_description;

var model = apex.region("IG_MON").widget().interactiveGrid("getViews", "grid").model;

col_project = model.getFieldKey("COL_MON_PROJECT");
col_hours = model.getFieldKey("COL_MON_HOURS");
col_description = model.getFieldKey("COL_MON_DESCRIPTION");

model.forEach(function (igrow) {

apex.item("P704_MON_PROJECT").setValue(igrow[col_project]);
apex.item("P704_MON_HOURS").setValue(igrow[col_hours]);
apex.item("P704_MON_DESCRIPTION").setValue(igrow[col_description]);

apex.server.process('POPULATE_COLLECTION_MON', {
pageItems: '#P704_MON_DATE,#P704_MON_PROJECT,#P704_MON_HOURS,#P704_MON_DESCRIPTION'
}, {
dataType: 'text',
success: function (data) {
if (data != 'SUCCESS');
}
});
});

Comments
Post Details
Added on Aug 20 2021
1 comment
2,176 views