I am trying to fetch all the selected records from the interactive grid in Oracle APEX by writing the below piece of code. I have also declared #myStaticIgId as the static Id of my report.
var record, USER_NAME;
var x = '';
var l_role = $v("P2_ROLE");
var l_justification = $v("P2_JUSTIFICATION");
var l_date = $v("P2_DATE");
//Identify the particular interactive grid
var ig$ = apex.region("myStaticIgId").widget();
//Fetch the model for the interactive grid
var grid = ig$.interactiveGrid("getViews","grid");
//Fetch the model for the interactive grid
var model = ig$.interactiveGrid("getViews","grid").model;
//Fetch selected records
var selectedRecords = apex.region("myStaticIgId").widget().interactiveGrid("getViews","grid").view$.grid("getSelectedRecords");
alert(selectedRecords.length);
//Loop through selected records
for (idx=0; idx < selectedRecords.length; idx++) {
//Get the record
record = model.getRecord(selectedRecords[idx][0]);
alert(record);
//Get the current value for USER_NAME
USER_NAME = model.getValue(record,"USER_NAME");
// USER_NAME = 'Abha';
alert('submit 2');
}
The alert statement that I have written for returning the record value, returns NULL to me.
Can you please suggest, what needs to be done so as to get the proper record value in record variable.
Regards, Abha

