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

Oracle Application Express is a rapid development tool for Web applications on the Oracle database.
Post Reply
admin
Posts: 2096
Joined: Fri Mar 31, 2006 12:59 am
Location: Pakistan
Contact:

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

Post 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);
});
You do not have the required permissions to view the files attached to this post.
Malik Sikandar Hayat
Oracle ACE Pro
info@erpstuff.com
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests