Inserting a new Record into an Interactive Grid using JavaScripts in Apex 20.2.

Опубликовано: 14 Октябрь 2024
на канале: Oracle Testlab
5,442
46

This is very simple example of how you can add a record in an interactive grid using Javascript. This example can be enhanced to incorporate complex business needs. this the basic. viewers find many ways to enhance the concept.

///Java Script Code
////////////////////////////
function addToIg() {
// IG region static ID
var $widget = apex.region('DEMO').widget();
var $grid = $widget.interactiveGrid('getViews', 'grid');
var $model = $grid.model;
var vname = $v('P39_NAME');

//insert new record on a model
var newRecordId = $model.insertNewRecord();

//get the new record
var $newRecord = $model.getRecord(newRecordId);

//update record values
$model.setValue($newRecord, 'NAME', vname);
}