Project: Plug-ins-Plus : Interactive Grid Checkbox Pro

Table of Contents

Introduction

Fill the gap in the interactive grid and enhance it with the missing checkbox component. Let your users change Yes/No columns in a convenient way - with a simple click on a checkbox or icon.

With the Interactive Grid Checkbox Pro plug-in, you don't have to write custom JavaScript code and CSS rules to implement checkboxes in your grids. You don't even have to bother with enabling edit mode in the grid. Simply change the column type to Interactive Grid Checkbox Pro and save your time and energy for more challenging tasks.

Features at Glance

Graphic Representation

The column value can be rendered as an HTML checkbox input or as an icon.

Instant Interaction

The end-user can change the state of the column without enabling edit mode in an interactive grid.

Built-in Validation

Built-in validation is used to prevent invalid data from being saved.

Easy-to-Use

No additional JavaScript configuration needed. Just change the column type to the plug-in and set the default values for the checked and unchecked states.

Three States Supported

The checkbox can be checked, not checked, or null.

Extended Change Event

Modified row data is exposed via the plug-in on change event.

Requirements

The table below describes the requirements that were used to define the plug-in scope.

Requirement

Interactive Grid Checkbox Pro

1

The plug-in should respect a column’s read-only state

(tick)

The plug-in renders a checkbox (or icon) in a column’s read-only state but it doesn’t change the state. Additionally, the checkbox is greyed.

2

The plug-in should support 3 states: checked, not checked, and null of an interactive grid column.

(tick)

The plug-in supports all 3 states and allows defining a default value for new interactive grid rows.

3

The plug-in should allow the state of a checkbox to change without enabling interactive grid edit mode.

(tick)

The plug-in exposes attributes which enable or disable the possibility to change the checkbox state outside of interactive grid edit mode.

Saving an interactive grid’s changes is necessary to preserve any changes.

4

The plug-in should allow changing the looks of the checkbox.

(tick)

The plug-in supports the native HTML checkbox and allows defining APEX icons for checkbox checked and not checked states.

The NULL state doesn’t render a checkbox or icon.

5

The plug-in should provide extra information about the purpose of a checkbox.

(tick)

The plug-in supports the title attribute for checkboxes and icons.

Hovering over a checkbox/icon displays the title.

6

The plug-in should raise an error when the current value is invalid.

(tick)

The plug-in has a built-in validation function which checks (on interactive grid save) whether an item’s value is NULL, Checked Value, or Not Checked Value. If the current value is out of scope the error is raised.

7

The plug-in should expose a change event when checkbox state is changed

(tick)

The plug-in triggers the native change event and the plug-in change event with additional data describing the currently edited row of an interactive grid.

The Plug-in

The Interactive Grid Checkbox Pro is an item type plug-in for Oracle Application Express (APEX).

Checkbox States

Checked

The value representing the checked state must be set using the plug-in Value When Checked attribute. When a column contains this value, the plug-in renders a checked checkbox or the icon representing the checked state. An icon can be selected using the plug-in  Icon Checked attribute.

Not Checked

The value representing the not checked state must be set using the plug-in Value When Not Checked attribute. When a column contains this value, the plug-in renders an unchecked checkbox or the icon representing the not checked state. An icon can be selected using the plug-in Icon Not Checked attribute.

Null Value

When the column value is NULL, the interactive grid will not render a checkbox or an icon. However, activated columns containing a NULL value allow the end-user to set a checked or not checked value.

When NULL is used as the default value for new rows, a new row's checkbox/icon is semi-transparent. After changing the state of a new row checkbox/icon there is no way to make it null again without an additional dynamic action that sets the value to null.

Still, after focusing on the column (in interactive grid edit mode) containing the null value it is possible to change the value according to the plug-in configuration.

APEX Integration

Accessibility

Keyboard-only actions are supported. In an interactive grid, read mode navigate to a cell containing the plug-in and press the Enter key to activate interactive grid edit mode. When the plug-in checkbox or icon is in focus, you can change the state by pressing the Spacebar key.

Read-only State

The read-only column setting is supported by disabling the ability of the user to change the value when they click on the checkbox (or icon).

Dynamic Actions

Set Value

The plug-in supports the native Set value dynamic action. It can be used to set the value of the column based on the value in other columns.

Events

The Plug-in Change Event

The plug-in exposes the Change [United Codes Interactive Grid Checkbox] event. The difference between this event and the native column Change event is that it reveals additional data through this.data.

Event Data

Property

Description

this.data.region

The region interface returned from the execution of apex.region.

this.data.grid

The interactiveGridView interface returned from the getViews interactiveGrid widget method.

this.data.record

The result of the grid's widget method getActiveRecord.

this.data.recordId

Record id returned by the model interface using the getRecordId method.

this.data.column

The column name on which the plug-in change event occurred.

this.data.value

The current value of the given column in the given record.

Debug

The plug-in can be debugged using APEX debug mode in the browser console (client-side) and built-in debug.

Validation

The plug-in has built-in validation which is executed when the interactive grid is saved. If the value of a column using the plug-in is equal to the Value When Checked or Value When Not Checked attribute or is NULL then validation is successful. Otherwise, the built-in validation raises an error.

The validation error message can be customized using UC_IG_CHECKBOX_VALIDATION APEX Translation Text. Use %0 to reference a column label and %1 to reference the invalid value.

Attributes

Application Attributes

The plug-in doesn’t expose any application attributes.

Standard

Attribute

Checked

Is Visible Widget

(tick)

Standard Form Element

(tick)

Session State Changeable

(tick)

Has Read Only Attribute

(tick)

Has Escape Special Characters Attribute

(error)

Has Quick Pick Attributes

(error)

Has Source Attributes

(tick)

Format Mask Date Only

(error)

Format Mask Number Only

(error)

Has Element Attributes

(error)

Has Width Attributes

(error)

Has Height Attribute

(error)

Has Element Option Attribute

(error)

Has Placeholder Attribute

(error)

Has Icon Attribute

(error)

Has Encrypt Session State Attribute

(error)

Has List of Values

(error)

Has LOV Display Null Attributes

(error)

Has Cascading LOV Attributes

(error)

Join LOV for Column Display

(error)

Has Filter

(error)

Has Link

(error)

Has "'Initialization JavaScript Code" Attribute

(error)

Custom

These attributes are exposed in the page designer when the column type is set to the plug-in.

Attribute

Dependent on

Type

Description

Value When Checked

Not applicable

Text

This attribute value is used when the checkbox is checked.

Value When Not Checked

Not applicable

Text

This attribute value is used when checkbox is not checked. To use NULL, empty the attribute.

New Row Default Value

Not applicable

Select List

This attribute value is used as the default value for the checkbox when end-users add a new row to an interactive grid.

Available options include:

  • Null - the checkbox in the new row has the default NULL value.

  • Value Checked - the checkbox in the new row has the default value defined as the Value When Checked plug-in attribute.

  • Value Not Checked - the checkbox in the new row has the default value defined as the  Value When Not Checked plug-in attribute.

Type

Not applicable

Select List

Defines what the graphical visualization of the column value should be.

Available options include:

  • HTML checkbox input - when selected, the plug-in renders an HTML input checkbox.

  • APEX icons - when selected, the plug-in renders an APEX icon.

Icons representing checked and not checked states must be defined using the plug-in attributes Icon Checked and Icon Not Checked.

Icon Checked

Type

Icon

This attribute allows choosing an icon representing the checked state.

This attribute can be used to assign additional custom classes to the icon.

Icon Not Checked

Type

Icon

This attribute allows choosing an icon representing the not checked state.

This attribute can be used to assign additional custom classes to the icon.

Settings

Not applicable

Checkboxes

This attribute allows defining the behavior of the plug-in.

Available options include:

  • Add Title on Hover - when checked, the plug-in allows adding a title attribute with custom text to the checkbox or icon.

  • Clickable in Read Mode - when checked, the plug-in allows changing the checkbox state without enabling interactive grid edit mode.

Title

Settings

Text

This attribute defines the value of the title tag added to the checkbox or icon. The title is displayed after hovering over the plug-in checkbox or icon. You can use page items substitutions &PX_ITEM_NAME.

Help in the Page Designer

The plug-in attributes are exposed along with help text built into the page designer in the Help tab.

Example help for the Settings \ New Row Default Value plug-in attribute is presented below:

Usage Guide

This section describes an example implementation of the plug-in in an example Oracle APEX application. The usage guide shows the basic implementation of the plug-in and doesn’t describe the plug-in attributes.

Introduction

This usage guide is using the plug-in sample application IG_CHECKBOX_PLUGIN table. In an example application, page 710 is created. On the page, an interactive grid region called Example is created and contains three columns ID, EMP_NAME, and FLAG. The ID and EMP_NAME columns are Display Only and the FLAG column is a Text Field. The interactive grid supports editing and the primary key is set as the ID column.

The FLAG column is a VARCHAR2 column that can store flag values such as:

  • Y - when checked

  • N - when not checked

  • NULL - when the flag is not set

Creating a Plug-in Column

  1. Select the FLAG column

  2. Set Identification \ Type to United Codes IG Checkbox Pro [Plug-in]

  3. Set Settings \ Type to APEX icons

  4. For Settings \ Icon Checked use fa-check-square-o as the default value

  5. For Settings \ Icon Not Checked use the fa-square-o as the default value

  6. For Settings \ Value When Checked use Y as the default value

  7. For Settings \ Value When Not Checked use N as the default value

  8. For Settings \ New Row Default Value use Null as the default value

  9. (Optional) Set Settings \ Settings according to your requirements

  10. Save the page

The resulting page will look as follows:

Test the Implementation

  1. Open page 710 in a browser

  2. Test the checkbox inside and outside of interactive grid edit mode (behavior depends on the plug-in Settings \ Settings)

Sample Application

Interactive Grid Checkbox Pro is delivered with a sample application which describes all of the plug-in’s features with example implementations. The sample application describes and implements the following topics:

Checkbox states

The checkbox states page describes and shows the plug-in’s capability to handle the three states of the flag and how it handles column read-only state.

Integration

The integration page describes how the plug-in is integrated with the Oracle APEX interactive grid.

Styling

The styling page describes how the plug-in renders checkboxes in the different states of the interactive grid.