Skip to Main Content

Info

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:

IG-1 - IG Edit Disabled

Attributes -> Edit -> Enabled = No

IG-2- Region Read-Only

Attributes -> Edit -> Enabled = Yes
Region -> Read Only -> Always

IG-3 - Display Only columns

Attributes -> Edit -> Enabled = Yes
Columns (DEPTNO/DNAME) -> Identification -> Type -> Display Only

IG-4 - Read Only columns

Attributes -> Edit -> Enabled = Yes
Columns (DEPTNO/DNAME) -> Read Only -> Always

IG-5 - DA "After Refresh (Region)" Disable columns

Attributes -> Edit -> Enabled = Yes
DA -> Event = After Refresh (Region) -> Action = Disable -> Column(s) = DEPTNO,DNAME

IG-6 - DA "Row Initialization (IG)" Disable columns

Attributes -> Edit -> Enabled = Yes
DA -> Event = Row Initialization (IG) -> Action = Disable -> Column(s) = DEPTNO,DNAME

IG-7 - DA "Row Initialization (IG)" JavaScript

Attributes -> Edit -> Enabled = Yes
DA -> Event = Row Initialization (IG) -> Action = JavaScript = ".addClass('apex_disabled')" + ".attr('tabindex', '-1')" + ".prop('readonly', true)"

Code

Page

Identification
Page ID
Name
Javascript
Function and Global Variable Declaration

View

View
Name
DDL

Region

Identification
Sequence
Title
Type
Source
Source Type
Table Name

Region

Identification
Sequence
Title
Type
Source
Source Type
Table Name

Region

Identification
Sequence
Title
Type
Source
Source Type
Table Name

Region

Identification
Sequence
Title
Type
Source
Source Type
Table Name

Region

Identification
Sequence
Title
Type
Source
Source Type
Table Name

Region

Identification
Sequence
Title
Type
Source
Source Type
Table Name

Region

Identification
Sequence
Title
Type
Source
Source Type
Table Name

Button

Name
Button Name
Text Label / Alt
Displayed
Sequence
Display in Region

Button

Name
Button Name
Text Label / Alt
Displayed
Sequence
Display in Region

Button

Name
Button Name
Text Label / Alt
Displayed
Sequence
Display in Region

Button

Name
Button Name
Text Label / Alt
Displayed
Sequence
Display in Region

Button

Name
Button Name
Text Label / Alt
Displayed
Sequence
Display in Region

Button

Name
Button Name
Text Label / Alt
Displayed
Sequence
Display in Region

Dynamic Action

Identification
Name
Execution Options
Sequence
When
Event
Selection Type
Region
Server-Side Condition
Type
Expression 1
Expression 2
Advanced
Event Scope
True Action
Identification
Action
Execution Options
Sequence
Fire On Initialization
Affected Elements
Selection Type
Column(s)

Dynamic Action

Identification
Name
Execution Options
Sequence
When
Event
Selection Type
Region
Server-Side Condition
Type
Expression 1
Expression 2
Advanced
Event Scope
True Action
Identification
Action
Execution Options
Sequence
Fire On Initialization
Affected Elements
Selection Type
Column(s)

Dynamic Action

Identification
Name
Execution Options
Sequence
When
Event
Selection Type
Region
Server-Side Condition
Type
Expression 1
Expression 2
Advanced
Event Scope
True Action
Identification
Action
Settings
Code
Execution Options
Sequence
Fire On Initialization
Affected Elements
Selection Type
Column(s)

Process

Name
Button Name
Type
Process Point
Sequence
Process Point
Run Process
Source
Process

Process

Name
Button Name
Type
Process Point
Sequence
Process Point
Run Process
Source
Process
Conditions
When Button Pressed

Process

Name
Button Name
Type
Process Point
Sequence
Process Point
Run Process
Source
Process
Conditions
When Button Pressed

Process

Name
Button Name
Type
Process Point
Sequence
Process Point
Run Process
Source
Process
Conditions
When Button Pressed

Process

Name
Button Name
Type
Process Point
Sequence
Process Point
Run Process
Source
Process
Conditions
When Button Pressed

Process

Name
Button Name
Type
Process Point
Sequence
Process Point
Run Process
Source
Process
Conditions
When Button Pressed