Page 1 of 1

How to add select or select all checkboxes in Interactive Report?

Posted: Thu May 15, 2025 3:21 am
by admin
It is very normal to use Interactive Report and process selective records by giving checkboxes to users. Users can select single, multiple or can use select all and then process selected lines. By default till Oracle APEX 24.2.5 this functionality is not avaiable so here are the steps to enable such functionality.
selectall.jpg
Adding a column in table Optional
If you have already column to update or not required to update in the current table then you can skip this step.

Code: Select all

alter table "WKSP_ERPSTUFF"."EMP" add ("SELECTION" VARCHAR2(1));
Report SQL

Code: Select all

select EMPNO,
       apex_item.checkbox(1,EMPNO) as SELECTED,
       ENAME,
       JOB,
       MGR,
       HIREDATE,
       SAL,
       COMM,
       DEPTNO,
       STATUS,
       selection
  from EMP
Heading of column SELECTED

Code: Select all

<input type="checkbox" id="checkAll" >
Set Process

Code: Select all

DECLARE
    v_empno NUMBER;
BEGIN
    -- Process only selected checkboxes
    FOR i IN 1..apex_application.g_f01.COUNT LOOP
        v_empno := apex_application.g_f01(i);

        update emp set selection = 'Y' where empno = v_empno;

    END LOOP;

END;
Reset Button Code

Code: Select all

 update emp set selection = null;
Function and Global Variable Declaration

Code: Select all

$(document).on('click', '#checkAll', function () {
    $('input:checkbox').prop('checked', this.checked);
});