Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Close Dialog event handler

partlycloudyAug 1 2017 — edited Aug 3 2017

APEX 5.1.2

Modal dialog is a very versatile UX pattern, especially for a [Form on Table] page since it allows the page to be called from many other components by simply passing in the appropriate keys for the record. When the dialog is closed, I would like the appropriate content on the calling page refreshed to reflect the changes made in the dialog.

From what I can see, the steps to do this are

1. Add a Processing > After Submit > Close Dialog process as the last process on the dialog page

2. Add a dynamic action on the calling page with

   a. When > Event = Dialog Closed

   b. When > Selection Type = Component that triggered the dialog e.g. Region, link, button, etc.

   c. True action = Refresh some component

Questions:

1. If there are multiple components on a page that trigger the modal dialog, do we need to create multiple DAs to refresh each one, changing 2(b) and 2(c)? Or can we create a single DA with a Selection Type of Javascript expression window?  The TRUE action on that DA would then refresh all the components, tad overkill but easy to maintain.

2. Extending this some more, what if the modal dialog is called from multiple pages in the application? Can we create a single DA on Page 0 that would listen for the [Dialog Closed] event on all pages and trigger apex.event.trigger(<component>,'apexrefresh') as needed

3. Page 4 in the Sample Dialog application has a DA which uses the following Javascript code to display any success message generated by page processing on the dialog page. But the success message is hard-coded in the [Close Dialog] process, not on the actual page processes that update the data. So  for instance, if I have a Delete button/process on the modal page with a message Deleted successfully and a Save button with Saved successfully, how can I get the appropriate message to be sent back to the calling page via this.data.successMessage?

if ( this.data.successMessage ) {

    // use new API to show the success message if any that came from the dialog

    apex.message.showPageSuccess(this.data.successMessage.text);

}

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 31 2017
Added on Aug 1 2017
3 comments
1,423 views