Skip to Main Content

Refresh when closing Modal Dialogs

When closing Modal Dialogs, you may want to refresh the calling page (or objects on that page) underneath it.
This can be done easily enough, but there are a few potential issues you may run into:
  • The standard Dynamic Action event "Dialog Closed" does not run when the user clicks the 'X' in the upper right corner, or presses Escape. This can be fixed by using the jQuery UI dialogclose event.
  • If the calling page itself is a Modal Dialog, that page will "miss" the event because the event is only raised on the original calling page.
    For example: you have Page 1, which opens Modal Dialog 2, which opens Modal Dialog 3. Now if you close Modal Dialog 3, you may want to refresh Modal Dialog 2, but the event is only run on Page 1. And that "stack of Modal Dialogs" may be a lot longer than just 3.
The Dynamic Action listed below fixes both these issues.
It uses the jQuery UI dialogclose event, and it loops through the entire stack of Modal Dialogs (which are frames really) and the underlying Page, and refreshes the Modal Dialog or Page directly underneath the one that was just closed.

Code

Dynamic Action

Identification
Name
Execution Options
Sequence
When
Event
Custom Event
Selection Type
JavaScript Expression(s)
Advanced
Event Scope
True Action
Identification
Action
Settings
Code
Execution Options
Sequence
Fire On Initialization