Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to make Interactive grid column/cell read only via JS?

ApexMeisterSep 5 2018 — edited Sep 6 2018

I'm using apex 5.1 and universal theme.

I have a page with IG and a button (Add) to manually insert row (see below).

The Account No columns Is read only but if the user clicks the "Add" button I need to create a new row and update the IG column based on the items above the IG (4 items).

Below is the JS DA that I used to try to do this but I'm getting an error "Set value not allowed for field.".

   var grid      = apex.region('IG_DT').widget().interactiveGrid('getViews','grid');
   var model     = grid.model;
   var NewRecordId = model.insertNewRecord();
   var NewRecord = model.getRecord(NewRecordId);

   // Try to make the IG column modifiable since by default its read only.
   $("#IG_DT_ACCOUNT_NO").removeAttr('readonly');


   model.setValue(NewRecord, 'ACCOUNT_NO', $v('P81015_ACCOUNT_NO'));
   model.setValue(NewRecord, 'BEGIN_READ', $v('P81015_PREVIOUS_READING'));
   model.setValue(NewRecord, 'END_READ', $v('P81015_CURRENT_READING'));
   model.setValue(NewRecord, 'CONSUMPTION', $v('P81015_CONS'));

   // Try to change it back to read only

   $("#IG_DT_ACCOUNT_NO").attr('readonly','readonly');


   alert('done');
}

Please note that if I make the columns all modifiable the DA works and sets the value for the newly inserted row.

thanks

This post has been answered by Franck N on Sep 6 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 4 2018
Added on Sep 5 2018
1 comment
12,277 views