Accessing a value in the client side is important in any development. It will help the developer to do validations, setting value and other required changes in the UI before submitting the page. We can use the JavaScript to access the value in the front end. Here we are going to access the Interactive Grid (IG) cell values. There are multiple way to achieve the same. But here we are going to look into a simplest method

Technologies and Tools Used

The following technology has been used to achieve the expected output.

  • JavaScript
  • Oracle Apex

Use Case

In oracle apex, an IG can hold multiple values as in the form of rows and columns. User can add any number of rows. Suppose we want access the value of a cell before submitting the page we can use this method.This document explains how to access a value of a cell for the current (Selected) row by using Static ID property and JS.

Architecture

Following steps explains in detail,

Step 1:

Create the interactive report in oracle apex or go to the IG report column that want to access.

Step 2:

Set a Static ID. Salary and Ename columns are used here in this example.

Set Static ID as SAL_ID for salary column

Set Static ID as NAME_ID for ENAME column

Step 3:

Create a dynamic action on click of salary column as below. It can be based on our requirement.

Step 4:

Opt Action as Execute JavaScript code and Place the code as below.

var sal = apex.item(‘SAL_ID’).getValue();

var name = apex.item(‘NAME_ID’).getValue();

apex.message.alert (‘The salary for ‘+ name + ‘ is ‘+ sal);

 

The current values are available in ‘sal’ and ‘name’ variables. If we want to assign this value into a page item, It can be done as below.

apex.item( “P9_SALARY” ).setValue (sal);

apex.item( “P9_NAME” ).setValue (name);

 

Step 5:

Save and Run.

Screen Shot

Output:

By using the above method, we can access the values as below before submit.

Before clicking Sal column

After clicking on Sal Column

Recent Posts

Start typing and press Enter to search