Plug-in: IG – Set items
This plug-in lets you bind APEX page items to Interactive Grid columns and vice-versa.
I plan to release several IG plug-ins for my Kscope18 presentation Customizing the Interactive Grid with Plugins. This is the first and the most complex one. It was a lot of work to develop it, but very easy to use! The functionality is similar (but not equal) to the IG Cookbook example [Split Grid and Form Multi-edit] provided by John Snyders of the APEX team.
How to use
The default scenario is to execute this plugin on the ‘Selection Change [Interactive Grid]’ event. Other scenarios are not likely because you want to act on selected rows in the grid. All you need to set are the following attributes:
About the plug-in
Setting page items when a row is selected is a common requirement in our applications. While this is the main feature, the plug-in also has several extra features:
- Two-way data binding between columns and page items
- Set grid selection on page load, based on PK item values
- Disable page items for deleted or read-only columns
- Show grid errors inline for page items too
Two-way data binding between columns and page items
This means you can update the column in the grid and the page item value will change too. Also, updating an item value will update the column for the selected records. The plug-in keeps track of deleted rows so the items will become disabled.
You can select multiple rows in the grid and a change to the page item value will change the column value for all of the selected rows.
The item labels will show a delta icon indicating there are multiple rows selected.
For primary key items, the values will be concatenated separated by a colon. For example:
This makes it easy for you to use it in a custom PL/SQL process and loop through the primary key values. Take a look at the APEX_STRING.SPLIT function for more information about the usage.
Set grid selection on page load based on PK item values
By default, the first row is selected in the interactive grid. Sometimes you want another row to be selected, especially in a master-detail situation. You can turn this feature on or off.
Disable page items for deleted or read-only columns
Useful when you want to display grid column values but maybe editing the IG is not enabled. You could choose to change the items to ‘Display only’ or disable this feature.
Show grid errors inline for page items too
The errors after saving the grid are also displayed inline for the page items.
- Rows selected
- No rows selected
The plug-in has two events and can be used to show and hide regions. For a better user experience, we can hide the region with the page items if no rows are selected. Likewise, we want to show the region as soon as rows are selected.
The event also triggers on filtering the IG and the ‘no-data-found’ message is shown in the grid.
A detailed explanation can be found on the GitHub project page.
Because I believe this plug-in is of great value in many APEX applications, please provide me with feedback and feature requests! The place to provide feedback is: