Skip to Main Content

IR

Empno
Checkbox
Disabled
Empno
Checkbox
DeptnoEmpnoEnameJob
207369SMITHCLERK
307499ALLENSALESMAN
307521WARDSALESMAN
207566JONESMANAGER
307654MARTINSALESMAN
307698BLAKEMANAGER
107782CLARKMANAGER
207788SCOTTANALYST
107839KINGPRESIDENT
307844TURNERSALESMAN
  • 1 - 10 of 14

Info

A method to create a "change all" checkbox in the column heading of (interactive) reports.

This is an alternative to a commonly used technique, which uses javascript function $f_CheckFirstColumn.
Using that function has a few drawbacks:
  • It will always select the first checkbox column of the report, even when that is not the one you want. E.g. in this report it would select the "Was Selected" column instead of the "Select" column, because the sequence of the checkbox columns has been changed.
  • $f_CheckFirstColumn does not take into account whether a checkbox is disabled; if it is disabled, you probably don't want to change its status.
  • Consequently, the "select all" option is shown even when none of the checkboxes can be changed; not very elegant.
All these drawbacks are addressed by the method shown here.

Notes:
  • In Apex 5 and above, you need to explicitly set the Static ID of column EMPNO_CHECKBOX to EMPNO_CHECKBOX for the javascript to work (otherwise an internal id is used). This is not needed in Apex 4.2 and below.
  • For dynamic action "P1002_SELECTED_N update (on change)", "Fire On Page Load" has to be set to true. This doesn't seem logical but is needed to get this to work on 1st page load.
  • Toggle the "Deptno = 10" filter to see that the "select all" checkbox is only added if there is at least 1 enabled checkbox; adding it when none of the checkboxes can be changed would not make a lot of sense.

Dynamic Actions

  • "EMPNO_CHECKBOX label": Adds the "select all" checkbox to the Checkbox column heading. We do this using javascript, otherwise (if you just add this to the column header definition) the checkbox html code also appears in the Actions -> Select Columns list of the report. Not very nice.
  • "EMPNO_CHECKBOX_ALL javascript": Toggles the checkboxes in the report whenever the "select all" checkbox change.
  • "P1002_SELECTED_N update (on change)": Updates the "Selected" number field, whenever the IR is changed. Not needed for Classic Reports, see below.
  • "P1002_SELECTED_N update (after refresh)": Updates the "Selected" number field, whenever the IR is refreshed. We need both this and the "on change" dynamic action (for Interactive Reports anyway), to get both the checkbox selection and the report filter to work.

Code

Page

Identification
Page ID
Name

Region

Identification
Sequence
Title
Type
Source
Source Type
Region Source

Item

Identification
Sequence
Name
Display As
User Interface
Region
Advanced
Custom Attributes
Warn on Unsaved Changes

Dynamic Action

Identification
Name
Execution Options
Sequence
When
Event
Selection Type
Region
Advanced
Event Scope
True Action
Identification
Action
Settings
Code
Execution Options
Sequence
Fire On Initialization

Dynamic Action

Identification
Name
Execution Options
Sequence
When
Event
Selection Type
jQuery Selector(s)
Advanced
Event Scope
True Action
Identification
Action
Settings
Code
Execution Options
Sequence
Fire On Initialization

Dynamic Action

Identification
Name
Execution Options
Sequence
When
Event
Selection Type
Region
Advanced
Event Scope
True Action
Identification
Action
Settings
Code
Execution Options
Sequence
Fire On Initialization

Dynamic Action

Identification
Name
Execution Options
Sequence
When
Event
Selection Type
Region
Advanced
Event Scope
True Action
Identification
Action
Settings
Code
Execution Options
Sequence
Fire On Initialization