Hi guys,
Here is a demo of my “Bug” find.
https://apex.oracle.com/pls/apex/r/trtdemo/ig-bug-setselectedrecords/home
When I use the function "setSelectedRecords" on already displayed record the function works as it should. In case when the record is in a model but not displayed in a grid, it cannot be selected/focused. I see this as a bug since that was working in previous versions.
If you guys can check this out and find a workaround it will be highly appreciated. This is a MUST-have for a lot of our applications.
1. Step => Use fetchAll to populate the model with this record
2. Step select the record with "setSelectedRecords"
function setSelectedRecordByID(pGrid, pID) {
let widget = apex.region(pGrid ).widget();
let grid = widget.interactiveGrid("getViews","grid");
let model = grid.model;
let record = model.getRecord(pID);
if (record) {
console.log("STEP 1. fetch record: ", record);
grid.setSelectedRecords([record],true);
console.log("STEP 2. got record try setSelectedRecords: ", record);
}
else {
console.log("STEP 1. setSelectedRecordByID, record is null now fetchAll");
model.fetchAll( function( status ) {
console.log("setSelectedRecordByID, fetchAll status: ", status);
if ( status.done ) {
record = model.getRecord(pID);
grid.setSelectedRecords([record],true);
console.log("STEP 2. got record try setSelectedRecords: ", record);
}
});
}
}