简体   繁体   中英

Can someone explain this line of code in Apex

I'm very new to Oracle Apex and need help understanding this code I got from a tutorial on creating an app. I've searched and I think it's JavaScript but I'm not even sure.

There is a page and there is a Modal Dialog. This code is supposed to refresh the page that the dialog is attached to once the dialog is closed. In the Dialog section of the Modal Dialog, paste the following line in Attributes:

close: function(event, ui) {apex.navigation.dialog.close(true,{dialogPageId:&APP_PAGE_ID.});}

What is the close: part for? I know that function(..,..) declares a function in JavaScript.

I also found that apex.navigation.dialog.close(true) closes a dialog, but in this case the tutorial is saying that the user closed the dialog themselves and we're just detecting it so what's the point of this code?

Finally, I know that &APP_PAGE_ID. is how you get the ID of a page in Apex but what is dialogPageId: written before it for?

Link to tutorial

It's described in the docs . There is even an example of

{dialogPageId:3})

-- from the docs:

This example demonstrates closing a modal dialog page, and returning an object of page item, dialogPageId and its value of 3. The returned value can be used by the page that launched the modal dialog, via a Dialog Closed Dynamic Action event, to identify the page ID of the modal dialog that triggered the event.

About the close: . Check the help text for the Dialog > Attributes section in the builder. It says:

在此处输入图像描述

And in the jquery documentation that is mentioned you'll find a "close" event.

So to summarize: The "close:" is a function that will be fired when the dialog is closed and in the function the dialog id of the closed dialog is set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM