Introduction/ Issue: 

When working with Oracle APEX, it is common to open a modal dialog for updating records. Once the update is completed and the dialog is closed, refreshing the main page is often required to reflect the latest changes. This can be achieved using JavaScript without relying on a branch action

Why we need to do / Cause of the issue:

Using a branch to refresh the main page after closing a dialog can be cumbersome and inflexible. Implementing a JavaScript-based solution provides a more dynamic and efficient way to refresh the main page upon dialog closure. This is especially useful when handling multiple dialogs or when you need precise control over the refresh behavior.

 

How do we solve:

Step 1: Configure the Modal Page

  1. Create a process on the modal dialog page with the following settings:
    • Process Type: Close Dialog
    • Execution Point: After Submit (or after the desired update is completed)

This ensures that the dialog closes once the process is completed.

Step 2: Create a Dynamic Action on the Main Page

  1. Navigate to the Main Page and create a new Dynamic Action with the following configuration:
    • Event: Dialog Closed
    • Selection Type: JavaScript Expression
    • JavaScript Expression: window
  2. Add a Client-Side Condition to ensure the refresh occurs only for the relevant dialog:
    • Type: JavaScript Expression
    • Expression:

this.browserEvent != “load” && this.data.dialogPageId == “6”

                            (Replace 6 with the actual page number of your modal dialog.)

  1. True Action: Refresh
    • Selection Type: Region (Choose the region you want to refresh)

This ensures that the main page refreshes only when the dialog with page ID 6 is closed.

 

Conclusion:

By implementing a JavaScript-based dynamic action, we can refresh the main page after closing a dialog without using a branch. This approach provides better control over the refresh process, enhances performance, and is more adaptable to complex workflows in Oracle APEX.

Recent Posts

Start typing and press Enter to search