15.2 Managing Dynamic Actions
Dynamic actions enable developers to define complex client-side behavior declaratively without the need for JavaScript.
- About Dynamic Actions
Dynamic actions provide a way to define complex client-side behavior declaratively without the need for JavaScript. Using the Dynamic Action Create wizard, you specify an action that is performed when a defined set of conditions occur. You can also specify which elements are affected by the action, and when and how they are affected. - About Dynamic Action Events
You can define dynamic actions to fire based on events that happen on the page. Oracle Application Express includes four different categories of events: Browser events, Framework events, Component events, and Custom events. This section describes all supported events, including the internal JavaScript event name in brackets. - Creating a Dynamic Action
Creating a dynamic action involves specifying when the action happens (with optional conditions), what action or actions are performed, and what elements are affected by the action. To learn more about any Property Editor attribute, select the attribute and click the Help tab in the central pane. - Editing Dynamic Actions
Once you create a dynamic action, you can modify attributes defined during the creation process, specify attributes not available during the process (such as specifying an Authorization Scheme) and add additional true actions. - Defining Dynamic Action Event Scope
After creating the dynamic action, the scope of the action can be modified to trigger only once, for the lifetime of the current page, or until triggering elements are updated by a Partial Page Refresh (PPR). - Deleting a Dynamic Action
Delete a dynamic action by selecting it in Page Designer and selecting Delete from the context menu. - About Calling JavaScript Using a Dynamic Action
You can execute JavaScript code by creating a dynamic action. - Debugging Dynamic Actions
Learn how to debug dynamic actions in Oracle Application Express.
See Also:
Parent topic: Managing Database Application Controls
15.2.1 About Dynamic Actions
Dynamic actions provide a way to define complex client-side behavior declaratively without the need for JavaScript. Using the Dynamic Action Create wizard, you specify an action that is performed when a defined set of conditions occur. You can also specify which elements are affected by the action, and when and how they are affected.
When working with dynamic actions, you should be mindful of the fact that the more dynamic actions you add to a page, the greater your overall page size. This is because the dynamic action framework emits additional code to the client for each dynamic action defined, which then also must be downloaded and executed by the framework in the client.
The process of implementing a dynamic action involves the following steps:
-
Create (or use an existing) page component such as an item, button or region. This component is referenced within the dynamic action, in defining when it fires.
-
Create a dynamic action from the application page that invokes the action.
-
Run your application to test the dynamic action.
Tip:
See "Debugging Dynamic Actions" for information on how to debug problems.
Viewing Dynamic Action Examples
To view dynamic action examples, install the Sample Dynamic Actions sample application. As an alternative, go to the Oracle Learning Library at http://www.oracle.com/oll/apex. Enter search criteria in the field provided (for example, dynamic actions
) and click Search.
See Also:
Parent topic: Managing Dynamic Actions
15.2.2 About Dynamic Action Events
You can define dynamic actions to fire based on events that happen on the page. Oracle Application Express includes four different categories of events: Browser events, Framework events, Component events, and Custom events. This section describes all supported events, including the internal JavaScript event name in brackets.
Browser Events
Note:
The events displayed differ according to the page's current User Interface type. If you want to select an event that corresponds to a different type, then you have the option of selecting Show unsupported, which displays all events including those that do not correspond to the current type.
-
Change (
change
) - Fires when a control loses the input focus and its value has been modified since gaining focus. -
Click (
click
) - Fires when the pointing device button is clicked over the triggering element. -
Double Click (
dblclick
) - Fires when the pointing device button is double clicked over the triggering element. -
Double Tap (
apexdoubletap
) - Fires when the pointer is doing a double tap/click. -
Get Focus (
focusing
) - Fires when the triggering element receives focus by either a pointing device or by tabbing into the element. -
Key Down (
keydown
) - Fires when a key on the keyboard is pressed. Use this event when you want to capture special keystrokes such as arrow keys, after a key has been pressed. -
Key Press (
keypress
) - Fires when a key on the keyboard is pressed resulting in text being entered. Use this event when you want to capture actual text entry. -
Key Release (
keyup
) - Fires when a key on the keyboard is released. Use this event when you want to capture special keystrokes such as arrow keys, after a key has been released. -
Lose Focus (
focusout
) - Fires when the triggering element loses focus either by the pointing device or by tabbing out of the element. -
Mouse Button Press (
mousedown
) - Fires when the pointing device button is pressed over the triggering element. -
Mouse Button Release (
mouseup
) - Fires when the pointing device button is released over the triggering element. -
Mouse Enter (
mouseenter
) - Fires once when the pointing device is moved into the triggering element. -
Mouse Leave (
mouseleave
) - Fires once when the pointing device is moved away from the triggering element. -
Mouse Move (
mousemove
) - Fires when the pointing device is moved while it is over the triggering element. -
Pan (
apexpan
) - Fires when the pointer is down, then moved in a horizontal direction. -
Page Load
ready
– Fires when the page loads. -
Page Unload (
unload
) - Fires when a page is unloaded. -
Press (
apexpress
) - Fires when the pointer is down for greater than 250ms. -
Resize (
resize
) - Fires when the browser window is resized. -
Resource Load (
load
) - When the triggering element is the window element (using a JavaScript Expression value ofwindow
in the When attributes), the event fires when the browser finishes loading all content within a document, including window, frames, objects and images. For other elements, this event can only be used for elements associated with a URL: images, scripts, frames, iframes. -
Scroll (
scroll
) - Fires when a scrollable triggering element is scrolled. This could be the browser window (using a JavaScript Expression value ofwindow
in the When attributes), scrollable frames or elements with theoverflow
CSS property set toscroll
(orauto
when the element's explicit height is less than the height of its contents). -
Select (
select
) - Fires when a user selects some text in a text field. -
Swipe (
apexswipe
) - Fires when the pointer is moving fast in a horizontal direction. -
Tap (
apextap
) - Fires when the pointer is doing a small tap click.
Framework Events
-
After Refresh (
apexafterrefresh
) - Fires after the triggering element has been refreshed. The event is only valid for triggering elements that perform Partial Page Refresh and fire this event. The native components that support this are Interactive Reports, Classic Reports, Charts, List View and all item types with cascading LOV support. Plug-ins might support this event as well. This event can be sent by theapex.server.plugin
andapex.server.process
APIs when therefreshObject
option is provided. See "apex.server" in Oracle Application Express JavaScript API Reference -
Before Page Submit (
apexbeforepagesubmit
) - Fires before a page being submitted. -
Before Refresh (
apexbeforerefresh
) - Fires before the triggering element has been refreshed. The event is only valid for triggering elements that perform Partial Page Refresh and fire this event. The native components that support this are Interactive Reports, Classic Reports, Charts, List View and all item types with cascading LOV support. Plug-ins might support this event as well. This event can be sent by theapex.server.plugin
andapex.server.process
APIs when the refreshObject option is provided. See "apex.server" in Oracle Application Express JavaScript API Reference. -
Dialog Closed (
apexafterclosedialog
) - Fires when an Application Express dialog is closed. This event only fires when the dialog is closed using the 'Close Dialog' page process, or the 'Close Dialog' dynamic action.
Component Events
These events are available when there is a component (either an item, region, or dynamic action) available to your application that triggers a custom event. These events appear in the following format Event name [Component Name], for example the Change Order event triggered by the Shuttle native item type appears as Change Order [Shuttle]. Component events are either triggered from native components shipped with Oracle Application Express, or from plug-in components you have installed into your application.
-
Events triggered by native components:
These will be in the format Event name [Component Name]. For help related to events raised by our native components, see
interactiveGrid
andtreeView
. See "interactiveGrid" and " treeView" in Oracle Application Express JavaScript API Reference. -
Events triggered by plug-in components:
These will be available when added to your current application and will be in the format Event name [Component Name]. For help related to events raised by plug-ins, refer to Help text on the plug-in configuration page, by navigating to Shared Components, Plug-ins, plug-in name, Help Text, where the plug-in author may have included documentation.
Custom Events
-
Custom Events:
By selecting Custom an additional field displays enabling you to define of a custom event. This is useful when the native or plug-in provided events are insufficient.
Parent topic: Managing Dynamic Actions
15.2.3 Creating a Dynamic Action
Creating a dynamic action involves specifying when the action happens (with optional conditions), what action or actions are performed, and what elements are affected by the action. To learn more about any Property Editor attribute, select the attribute and click the Help tab in the central pane.
To create a dynamic action in Page Designer:
See Also:
Parent topic: Managing Dynamic Actions
15.2.4 Editing Dynamic Actions
Once you create a dynamic action, you can modify attributes defined during the creation process, specify attributes not available during the process (such as specifying an Authorization Scheme) and add additional true actions.
To edit a dynamic action:
Parent topic: Managing Dynamic Actions
15.2.5 Defining Dynamic Action Event Scope
After creating the dynamic action, the scope of the action can be modified to trigger only once, for the lifetime of the current page, or until triggering elements are updated by a Partial Page Refresh (PPR).
To specify scope:
Parent topic: Managing Dynamic Actions
15.2.6 Deleting a Dynamic Action
Delete a dynamic action by selecting it in Page Designer and selecting Delete from the context menu.
To delete a dynamic action:
Parent topic: Managing Dynamic Actions
15.2.7 About Calling JavaScript Using a Dynamic Action
You can execute JavaScript code by creating a dynamic action.
Although Dynamic Actions are designed to be low code, there are a number of places where you can extend the native possibilities with custom JavaScript code. You can use a JavaScript Expression for a custom Client-Side condition, which can be useful for example if you want to based your condition on multiple item values. In addition, you can also execute JavaScript code by creating a dynamic action with the Execute JavaScript Code or Set Value actions
See Also:
Parent topic: Managing Dynamic Actions
15.2.8 Debugging Dynamic Actions
Learn how to debug dynamic actions in Oracle Application Express.
15.2.8.1 About Debugging Dynamic Actions
Debugging dynamic actions in Oracle Application Express is slightly different than other debugging, because much of the processing done with the dynamic action framework is done on the client, not on the server. To debug dynamic actions, Oracle Application Express outputs debug information to the browser's JavaScript console if your browser supports it (for example Firefox with Firebug installed shows the debug information in its Console pane). The debug information tells you when an action of a dynamic action fires, along with some additional information about the dynamic action, in the following format:
Dynamic Action Fired: [Dynamic Action name] ([Action name]) {JavaScript object containing all Dynamic Action information}
This format enables you to identify the dynamic action name, the action name which indicates which action is triggered, and the JavaScript object which contains a lot of information about the dynamic action, including the when element, the affected elements, the event object and any data that may be associated with the dynamic action.
Parent topic: Debugging Dynamic Actions
15.2.8.2 Debugging Dynamic Actions
To debug a dynamic action:
Parent topic: Debugging Dynamic Actions