0
votes

I have an interactive grid with a bunch of records, and I want to set up a button on the page that changes one column in all records currently selected.

Running APEX 5.1,the IG has a whole bunch of columns and I want to change just one of them, but on a whole bunch of rows, so I do need a button. Primary Key on this table is assembled from 5 fields.

I don't really know much Javascript, so I don't know what went wrong or how to best fix it.

I set up a Dynamic action on button click that executes Javascript and I have the selected element being the region named config.

var g = apex.region('config').widget().interactiveGrid('getViews','grid');  
var r = g.getSelectedRecords();  
for(i = 0; i < r.length; i++) {   
g.model.setValue(r[i], 'EFCTV_END_DT', 'sysdate');
}

where EFCTV_END_DT is the column name, and sysdate is the value this column needs to be updated to.

Upon running this code, I am getting this error:

Ajax call returned server error ORA-20987: APEX - ERR-1002 Unable to find item ID for item "C100812889833598308" in application "220". - Unexpected error, unable to find item name at application or page level. for .

Can someone help me in implementing this?

1
I'm not sure why you're getting an Ajax error based on what you've specified. Please set up an example on apex.oracle.com and provide us with developer credentials. When ready, provide step by step instructions on how to reproduce the issue.Dan McGhan

1 Answers

0
votes

Found the solution to this issue:

APEX wasn't identifying what sysdate meant.

Changed the Javascript code to:

var g = apex.region('config').widget().interactiveGrid('getViews','grid');  
var r = g.getSelectedRecords();  
var monthNames =["JAN","FEB","MAR","APR",
                      "MAY","JUN","JUL","AUG",
                      "SEP", "OCT","NOV","DEC"];
var today = new Date();
var dd = today.getDate();
var mm = monthNames[today.getMonth()];
var yyyy = today.getFullYear();
today = dd+'-'+mm+'-'+yyyy;
for(i = 0; i < r.length; i++) { 
    g.model.setValue(r[i],'EFCTV_END_DT',today);
}

And now, it is working as intended.