oracle apex ig action getSelectedRecords
$s("P5_SELECTED_ROWS", "");
// IG static id is defined as emp
var gridView = apex.region("emp").widget().interactiveGrid("getViews").grid;
var records = gridView.getSelectedRecords();
var empNo;
// define empty JSON object to hold selected rows
var selRecords = {
"rows": []
};
var selRecordsJSON;
if (records.length > 0) {
if (confirm("Do you want to update commission for selected employee(s)? Please confirm.")) {
$.each(records, function(i, r) {
// employee number defined as PK for IG
empNo = gridView.model.getRecordId(r);
// you can also get other columns values using below code
// ENAME is column name in IG query
//empName = gridView.model.getValue(r, "ENAME");
// Push selected rows into an array
selRecords.rows.push({
"empNo": empNo
});
});
// convert JSON into string
selRecordsJSON = JSON.stringify(selRecords);
console.log(selRecordsJSON); apex.page.submit({
request: "UPDATE_COMMISSION",
set: {
"P5_SELECTED_ROWS": selRecordsJSON
},
showWait: true
});
}
} else {
alert("Please select atleast one employee.");
}