- Oracle APEX Cookbook(Second Edition)
- Marcel Van Der Plas Michel Van Zoest
- 494字
- 2021-07-23 15:34:38
Controlling the display of regions and items with Dynamic Actions>
Dynamic Actions are control items that dynamically can affect the display of regions or items on a page. There are several situations when you want to show or hide items. For example, a text item asking for a maiden name should only be displayed when the person is female and married. In other cases, it is irrelevant to ask for a maiden name (on the other hand, with homosexual marriages it's possible for a man to have a "maiden" name, and in some cases a man can adopt the family name of his wife, but let's not make this example more difficult than necessary).
The same applies to the Commission field in the employees table. This item should only be enterable when the employee's job is a salesman. Let's build the functionality for this last situation.
Getting ready
You should already have an application and a simple single record form on the employees table.
How to do it...
- Right-click on the Dynamic Actions link in the leftmost section and click on Create.
- Select Standard and proceed to the next step.
- Enter a name for this dynamic action. For example,
D_JOB_COMM_SHOW
. Click on Next. - In the next screen, the Selection Type is Item(s) and in the Item(s) field, enter the name of the item holding Job. You can use the List of Values button to select the right Page Item.
- In the Condition list box, select equal to.
- In the Value textarea, enter SALESMAN. Click on Next.
- Select Show as the True Action and go to the next step.
- In the next screen select Item(s) in the Selection Type. In the shuttle item that now appears, move the name of the commission field to the right.
- Click on the Create button.
You have now created a dynamic action which shows the Commission field when the job is SALESMAN and hides the Commission field when the job is not SALESMAN.
How it works...
The Dynamic Actions are actually event handlers in HTML. There are several event handlers.
Because these events are HTML (or rather JavaScript) they are handled client side. This has the advantage that the page doesn't have to be reloaded completely when an action is triggered to show or hide items.


In our example, we use the onchange
event handler. So, when the user changes the value in JOB, the onchange
is triggered and it calls the action to show or hide the COMMISSION field, depending on the value in JOB. If it is SALESMAN then show commission, else hide commission.
There's more...
You can control the display of more than one item at a time. Simply separate the items by a comma in the items field.
You can also control the display of regions. So, you can show or hide a complete report. Instead of item, select region and the name of the region in the affected element section when defining an action.
- Hands-On Industrial Internet of Things
- Spring Boot 2.0 Projects
- PLC、現(xiàn)場總線及工業(yè)網(wǎng)絡(luò)實(shí)用技術(shù)速成
- 通信簡史:從信鴿到6G+
- 面向云平臺(tái)的物聯(lián)網(wǎng)多源異構(gòu)信息融合方法
- Getting Started with Grunt:The JavaScript Task Runner
- INSTANT KineticJS Starter
- 網(wǎng)管工具使用與技巧大全
- 5G時(shí)代的大數(shù)據(jù)技術(shù)架構(gòu)和關(guān)鍵技術(shù)詳解
- LwIP應(yīng)用開發(fā)實(shí)戰(zhàn)指南:基于STM32
- Hands-On Docker for Microservices with Python
- Python API Development Fundamentals
- NB-IoT原理和優(yōu)化
- 世界互聯(lián)網(wǎng)發(fā)展報(bào)告2021
- 物聯(lián)網(wǎng),So Easy!