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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Problem with autofill of an IG

So I've got an IG which can have a list of serial numbers. I have written some javascript to auto populate the IG with all all possible serial numbers. The javascript works fine if the IG is empty and has no pre-existing values. However, if the IG has one or two serial numbers already populated, and I run my autopopulate function, it will overwrite the previous two values with all the other values I'm populating. So essentially the two values seemingly disappear from my list. Essentially I want this function to append to the list, not overwrite it. I thought that is what the javascript would do when inserting a new row, but again, if there is a pre-existing row…. it gets clobbered by the function. I've included the javscript below to insert the rows. For any IG gurus, maybe someone can look at the function and tell me what I'm doing wrong.

function autofill_sn() {

var widget = apex.region('IG_SN').widget();
var grid = widget.interactiveGrid('getViews','grid');
var model = grid.model;

var myJSONString = $v("P345_SN_INFO_JSON"); – this is a list of serial nums not already in IG
var myObject = JSON.parse(myJSONString); model.clearData();
alert(myJSONString);

for ( var i = 0; i < myObject.length; i++) {

var obj = myObject[i];
//insert new record on a model
var myNewRecordId = model.insertNewRecord();
//get the new record
var myNewRecord = model.getRecord(myNewRecordId);
//update record values
model.setValue(myNewRecord, 'SN_ID', obj.serial_no);

};

}

Comments
Post Details
Added on Feb 4 2025
2 comments
61 views