Read Only options for Interactive Grids (IG).
Dynamically setting Interactive Grids columns to Read Only (or Disabled) can cause some cell values to become null when changing more than 1 row and then submitting the IG.
In the examples below, I have tried to replicate this without actually saving the changed data - I would like my DEPT table to stay unchanged for other pages :-) Also I have used "1 = 1" as the "dynamic" part, but you get the idea.
I have added Debug fields to all the IGs, which are filled with the column values of all modified rows, during the Submit.
The DEPTNO, DNAME and LOC_LOV columns are all Read Only in the examples below, using various methods.
The LOC column can be edited and "saved" by using the Submit button for that IG.
Note that Apex sets the DEPTNO columns option "Value Required" to true by default, which makes sense because that is the primary key.
However, because of the bug discussed here, this will result in a "Deptno must have some value" exception when saving the IG.
So I have set the "Value Required" option to false manually for IG-5, 6 and 7.
Also note that whenever you make query/column changes to the IG, Apex will reset this to true - which I consider to be a bug. See my
Synchronize Page Items page for more details - it's not the exact same feature/bug, but very similar.
In the IGs below I have added LOC_LOV, which is a Pop-up LOV column, because it requires a different bit of JavaScript (see IG-7).
IG-1 and IG-2 are there for reference only. All columns are disabled by default so no Submit option there. The columns do look different from the other IGs however, which is a shame, but that can be fixed with some CSS if you like.
IG-3 and IG-4 work fine, but of course the columns are not dynamically set to Disabled or Read Only.
IG-5 and IG-6 show the problem. If you change the value of only 1 row, it works fine.
But if you change the value of 2 or more rows, only the last row is OK - for the other rows, the Disable / Read Only columns have become null.
IG-7 fixes the problem by using some JavaScript, to make the cells look and behave "read only". Too bad JavaScript is needed here, but what can you do... The JavaScript function can both disable and enable columns, which may come in handy.
Info & inspiration: