Forum Stats

  • 3,767,865 Users
  • 2,252,726 Discussions
  • 7,874,367 Comments

Discussions

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

AmandaWalsh
AmandaWalsh Member Posts: 177 Bronze Badge
edited Aug 20, 2021 6:20AM in APEX Discussions

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');

      }

   });

});

Tagged: