Use the apex
namespace to store global variables and highly used functions in Application Express.
Global Variables
apex.gPageContext$
- Application Express variable that stores the current page context. The current page context is different depending on whether the page is a Desktop, or jQuery Mobile page. For Desktop, this is set to the document level. For jQuery Mobile, where pages are actually represented as DIV elements in the Browser DOM and multiple page DIVs can be loaded in the Browser DOM at one time, this is set to the DIV element representing the current page.
This is used to set the context for your jQuery selectors, to ensure that the selector is executing within the context of the correct page.
For example:
jQuery( ".my_class", apex.gPageContext$ );
This selects all elements with a CSS class of my_class
, in the context of the current page.
Topics:
The apex.confirm
function displays a confirmation and depending on the user's choice either submits the page, or cancels a page submit. This function has 2 signatures, as described below.
Topics:
Displays a confirmation showing a message, pMessage
, and depending on user's choice, submits a page setting request value, pRequest
, or cancels page submit.
Parameters
pMessage (string) pRequest (string)
Example
This example shows a confirmation dialog with the text 'Delete Department'. If the user chooses to proceed with the delete, the current page is submitted with a REQUEST value of 'DELETE'
apex.confirm('Delete Department', 'DELETE');
Displays a confirmation showing a message (pMessage
) and depending on user's choice, submits a page setting request values specified by (pOptions
) or cancels page submit.
Parameters
pMessage (string) pOptions (Object) where pOptions can contain the following properties: submitIfEnter - If you only want to confirm when the ENTER key has been pressed, call apex.confirm in the event callback and pass the event object as this parameter. request - The request value to set (defaults to null) set - Object conatining name/value pairs of items to be set on the page prior to submission(defaults to null).
showWait - Flag to control if a 'Wait Indicator' icon is displayed, which can be useful when running long page operations (Defaults to false).
Return Values
Boolean - If the submitIfEnter
option is specified, a boolean value is returned. True is returned if the ENTER key was not pressed and false if the ENTER key was pressed. If submitIfEnter
is not been specified, nothing is returned.
Example
This example shows a confirmation message with the 'Save Department?' text. If the user chooses to proceed with the save, the page is submitted with a REQUEST
value of 'SAVE' and 2 page item values are set, P1_DEPTNO
to 10
and P1_EMPNO
to 5433
.
apex.confirm("Save Department?", { request:"SAVE", set:{"P1_DEPTNO":10, "P1_EMPNO":5433} });
The apex.submit
function submits the current page. This function has 2 signatures, as described below.
Topics:
This function submits the page using the options specified in pOptions
.
Parameters
pOptions (Object) where pOptions can contain the following properties: submitIfEnter - If you only want to submit when the ENTER key has been pressed, call apex.submit in the event callback and pass the event object as this parameter. request - The request value to set (defaults to null) set - Object conatining name/value pairs of items to be set on the page prior to submission(defaults to null).
showWait - Flag to control if a 'Wait Indicator' icon is displayed, which can be useful when running long page operations (Defaults to false).
Return Values
Boolean - If the submitIfEnter
option is specified, a boolean value is returned. True is returned if the ENTER key was not pressed and false if the ENTER key was pressed. If submitIfEnter
is not been specified, nothing is returned.
Example
This example submits the page with a REQUEST value of 'DELETE' and 2 page item values are set, P1_DEPTNO
to 10
and P1_EMPNO
to 5433
. During submit a wait icon is displayed as visual indicator for the user as well.
apex.submit({ request:"DELETE", set:{"P1_DEPTNO":10, "P1_EMPNO":5433});
This function submits the page setting the Application Express Request value pRequest
.
Parameters
pRequest (String)
Example
Submits the current page with a REQUEST value of 'DELETE'.
apex.submit( 'DELETE' );