Search code examples
sqloracleplsqloracle-apex-20.2interactive-grid

Oracle Apex Interactive Grid Disable a ROW based on a condition


I have a table called TABLE_A with fields ID, FIRST_NAME, LAST_NAME, AGE, STATUS.

From this table i have an interactive grid in ORACLE APEX 20.2 and i want when the status is approved then the entire row of that record in the grid to be disabled (not editable). I have done research but they are spoke and describe COLUMN DISABLING. I do not want to disable column based on a condition, i want to disable a row.

In oracle apex, i used the read-only feature on the interactive grid. With the read-only feature, i had a sql query on rows returned as shown below but when i use this, it makes the entire gird is not editable:

SQL Query When Rows Returned

select 1 from TABLE_A where upper(STATUS) = 'APPROVED';

Screenshot From Oracle Apex

enter image description here

enter image description here

One link to what i research: https://community.oracle.com/tech/developers/discussion/4482243/oracle-apex-lock-disable-specific-columns-in-interactive-grid

Your help would be appreciated!


Solution

  • I don't know how many different status do you have. But I assume there are only two values in this column: Approved and Not Approved

    Then you can try this query:

    select a.* , decode(UPPER(a.status),'NOT APPROVED','U' ,'X') as EDITABLE  from TABLE_A a
    

    Then you should use Alowed row operation column in Apex.

    After creating the column, click on the Attributes node of the interactive grid and specify the EDITABLE column for the Allowed Row Operations Column property.

    enter image description here

    This tool allows data to be changed according to different values:

    • U – allow row update
    • D – allow row delete
    • UD – allow both Update and Delete
    • If anything else is returned the row will not be editable.