In this post you will learn how to create a dynamic action in Oracle Apex.
Dynamic action is a compelling part of Oracle Apex. Using dynamic action, you can perform several tasks.
Dynamic action can be created on the Page, Regions, Items. And the following is the list of events on which you can create a DA in Oracle Apex:
- Double Click
- Double Tap
- Get Focus
- Key Down
- Key Press
- Lost Focus
- Mouse Button Press
- Mouse Button Release
- Mouse Enter
- Mouse Leave
- Mouse Move
- Page Load
- Page Unload
- Resource Load
- After Refresh
- Before Page Submit
- Before Refresh
- Dialog Closed
- Date Selected [Calendar]
- Event Selected [Calendar]
- View Changed [Calendar]
- Facets Change [Faceted Search]
- Mode Change [Interactive Grid]
- Page Change [Interactive Grid]
- Report Change [Interactive Grid]
- Row Initialisation [Interactive Grid]
- Save [Interactive Grid]
- Selection Change [Interactive Grid]
- View Change [Interactive Grid]
- Selection Change [Tree]
- Update [Text Field with autocomplete]
- Markdownified [Markdown Editor]
- Change Order [Shuttle]
And also, you can create a dynamic action on the custom event. Below are the steps to create dynamic action in Oracle Apex. To demonstrate, I will create a dynamic action on a button.
The method is same to create a dynamic action on other type of items.
Create Dynamic Action in Oracle Apex Example
In Oracle Apex, open your page on which you want to create a dynamic action on a button or create a new one.
Then do the right-click on the button and from the shortcut menu select Create Dynamic Action option.
Now a new node under the button will be created and here you can set the properties as shown in the below image:
Now click on the node (Show) under the dynamic action node to select the Action you want to perform, such as Show or Hide an object, setting item value, etc. Below is the screenshot:
As you can see in the above image, I have created an Execute PL/SQL Code action for this dynamic action on button click.
And specified the dummy code in the PL/SQL code section. You also need to submit the items in the items to the Submit option if you are referring to any page item in your PL/SQL code.
And also, you need to specify the items in the Items to Return property if you are setting an item value in PL/SQL code.
For every dynamic action, there is a property Fire on Initialisation; you need to set it off if you don’t want it to execute when the page initializes.
But for some cases, you may require to keep it on so that the dynamic action can execute every time the page loads.
You can create not only one action on button click, but you can also create multiple actions under the True node. And they all will execute on the button click.
If you have specified a condition for the Client-side condition property then you can create actions also for the False node.
To check for more examples of dynamic actions, click the following link: Oracle Apex dynamic action examples.