Forum Stats

  • 3,827,547 Users
  • 2,260,791 Discussions


Interactive Grid JavaScript question ( "setSelectedRecords" )

Rick-Pick Member Posts: 96 Bronze Badge

I'm using APEX 20.1.2.

I need to refresh one or more records in an IG after visiting a modal page which, when closed, returns an item which identifies the records to be refreshed. I'm trying to do this by first selecting the records in JavaScript and then using the "selection-refresh" action to refresh them.

The following example works with hardcoded record ids and does exactly what I want:

apex.region( "attendees" ).call( "setSelectedRecords", ["29786558","29786559"] );

apex.region( "attendees" ).call( "getActions" ).invoke( "selection-refresh" );

Of course, I can't hard code the ids, so I'm using a PL/SQL DA to populate a hidden item with comma-separated record ids, with quotes, as in the above array. In the JavaScript, I have got:

var recIds =  $v("P1_RETURNED_REC_IDS").split( "," );

This should, and does, create an array, recIds, containing the quoted and comma-separated ids, but then

apex.region( "attendees" ).call( "setSelectedRecords", recIds );

doesn't select the records. I have tried many things, but haven't come up with the answer.