1. Overview

This document talks about selecting the same row in interactive grid report on change of pagination. This has been achieved using JavaScript.

2. Technologies and Tools Used

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

  • Oracle Apex
  • JavaScript

3. Use Case

Users can seamlessly navigate between different sections of the application without losing context. and also Saves time by eliminating the need for users to manually search for records they were previously interacting with.

 

This document explains how to achieve this requirement.

4. Architecture 

Following steps explains in detail,

Step 1:

  • We need to create four hidden Page Items on Interactive grid report page.

Step 2:

Create Dynamic action on report to store data in hidden page item below Code.

Action: Execute JavaScript

Code:

var gridID = “EMPLOYEES_IR”;

var ig$ = apex.region(gridID).widget();

var grid = ig$.interactiveGrid(“getViews”,”grid”);

var selectedRecord = grid.getSelectedRecords();

var gridData = apex.region(“EMPLOYEES_IR”).call(“getViews”).grid.view$.data(“apex-grid”);

var currentPage = Math.floor(gridData.pageOffset / gridData.pageSize) + 1;

apex.item(‘P4_PAGE_ID’).setValue(currentPage);

var i,I_SELECTED_VAL,

model = this.data.model;

for ( i = 0; i < this.data.selectedRecords.length; i++ ) {

I_SELECTED_VAL = model.getValue( this.data.selectedRecords[i], “EMPNO”);

}

apex.item(“P4_PRI_VALUE”).setValue (I_SELECTED_VAL);

Step 3:

Again Create Dynamic Action on Page Load.

Code:

setTimeout(function() {

var val = $v(“P4_PRI_VALUE_1”);

apex.region(“EMPLOYEES_IR”).call(“getViews”).grid.view$.grid(‘gotoPage’,$(‘#P4_PAGE_ID_1’).val()-1);

apex.region(‘EMPLOYEES_IR’).widget().interactiveGrid(‘setSelectedRecords’, [String(val)]);

}, 1000);

Step 4:  Go to other page and Create Two hidden page item with P1_PAGE_ID and P1_PRI_VALUE.

Step 5: After that on Back button pass the value to the previous report page as below Screenshot.

Step 6: After that go to the previous report page and create branch as below screenShot.

5. Screen Shot

Output:

Using above the steps we can go to the same row in interactive grid report when back from other page in Oracle Apex.

Recommended Posts

Start typing and press Enter to search