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