The apex namespace is the top level Oracle Application Express namespace and contains a number of sub namespaces, and a few common functions and properties.
The apex namespace also contains information on Application Express specific events.
- actions
- da
- debug
- event
- item
- lang
- message
- model
- navigation
- page
- region
- server
- storage
- theme
- util
- widget
This namespace property 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 HTML document (same as apex.jQuery(document)). 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.
Type:
- jQuery
Example
apex.jQuery( ".my_class", apex.gPageContext$ );
This namespace property holds the jQuery function that APEX uses. Ideally there is just one copy of jQuery on a page but it is possible to have multiple copies and even different versions of jQuery on a page. This is sometimes necessary when using third party plugins that only work with an older version of jQuery. Use this property in place of global variables $ or jQuery to ensure you are using the same jQuery library that Application Express is using.
Type:
- function
Example
function myFunction() {
var $ = apex.jQuery;
// use $ to access jQuery functionality
}
This event is triggered when an Application Express modal dialog page is closed by either the Dynamic Action Close Dialog action or the Close Dialog process. This is equivalent to the Dialog Closed Dynamic Action event. This event is triggered on the element that opened the dialog.
For buttons it is the button element. For links to dialog pages in lists it is the list region element. For lists used in global top or side navigation or in any other case where the triggering element cannot be determined the event is triggered on the document apex.gPageContext$.
Note: This event is triggered in the parent or calling page not in the modal dialog page.
If you want to know when the dialog is closed regardless of how it is closed use the
jQuery UI dialogclose
event.
Properties:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Event |
Event | jQuery event object |
|||||||||
data |
object | The event handler receives an object argument with these properties.
Properties
|
Example
apex.gPageContext$.on( "apexafterclosedialog", function( event, data ) {
apex.region( "emp" ).refresh();
});
This event is triggered by a number of page or column items just after they are refreshed with new content or
data from the server. It is equivalent to the Dynamic Action event After Refresh. Specifically any item that
supports the Cascading LOV Parent Item(s) attribute should trigger this event. This event can also be triggered
by the apex.server.plugin and apex.server.process APIs if the refreshObject
option is provided.
The event is triggered on the item element or the element given by the refreshObject
. The event handler receives
the data given in refreshObjectData
if any.
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
event |
Event | jQuery event object. |
|
data |
Object |
<optional> |
The refreshObjectData if any. |
Example
apex.jQuery( "body" ).on( "apexbeforerefresh", function() {
apex.jQuery( "#B1" ).prop( "disabled", true);
} ).on( "apexafterrefresh", function() {
apex.jQuery( "#B1" ).prop( "disabled", false);
} );
This event is triggered when the page is submitted with apex.page.submit or apex.page.confirm. This includes buttons with action Submit Page and Dynamic Action Submit Page action. It is equivalent to the Dynamic Action event Before Page Submit. It is triggered before the page is validated. It is triggered on apex.gPageContext$, which is the document for Desktop UI pages and the page div for jQuery Mobile UI pages. This event can be canceled by a Dynamic Action Confirm or Cancel Event action so you cannot rely on the page actually being submitted. If you need code to run just before the page is actually submitted see the apex.event:apexpagesubmit event.
The event handler should not do any long running or asynchronous processing. Specifically it should not make a synchronous or asynchronous Ajax request. The event handler receives a string argument that is the request value.
Properties:
Name | Type | Description |
---|---|---|
event |
Event | jQuery event object. |
request |
string | The request string. |
Example
apex.jQuery( apex.gPageContext$ ).on( "apexbeforepagesubmit", function() {
var item = apex.item("P1_CHECK_ME" ),
value = item.getValue();
if ( value !== "valid" ) { // replace with desired constraint check
item.node.setCustomValidity( "Text field needs to be valid" );
} else {
item.node.setCustomValidity( "" );
}
} );
This event is triggered by a number of page or column items just before they are refreshed with new content or
data from the server. It is equivalent to the Dynamic Action event Before Refresh. Specifically any item that
supports the Cascading LOV Parent Item(s) attribute should trigger this event. This event can also be triggered
by the apex.server.plugin and apex.server.process APIs if the refreshObject
option is provided.
The event is triggered on the item element or the element given by the refreshObject
. The event handler receives
the data given in refreshObjectData
if any.
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
event |
Event | jQuery event object. |
|
data |
Object |
<optional> |
The refreshObjectData if any. |
Example
apex.jQuery( "body" ).on( "apexbeforerefresh", function() {
apex.jQuery( "#B1" ).prop( "disabled", true);
} ).on( "apexafterrefresh", function() {
apex.jQuery( "#B1" ).prop( "disabled", false);
} );
This event is triggered when a model row/record is about to be edited (when a new row/record is selected or enters edit mode).
Properties:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
event |
Event | jQuery event object. |
||||||||||||
data |
object | Additional event data.
Properties
|
This event is triggered when a model row/record is done being edited (when a new row/record is selected or exits edit mode).
Properties:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
event |
Event | jQuery event object. |
||||||||||||
data |
object | Additional event data.
Properties
|
This event is triggered when the page is submitted with apex.page.submit or apex.page.confirm. This includes buttons with action Submit Page and Dynamic Action Submit Page action. It is triggered after the page is validated. It is triggered on apex.gPageContext$, which is the document for Desktop UI pages and the page div for jQuery Mobile UI pages. This event is the last chance to set or modify page items before the page is submitted.
The event handler should not do any long running or asynchronous processing. Specifically it should not make a synchronous or asynchronous Ajax request. The event handler receives a string argument that is the request value.
Properties:
Name | Type | Description |
---|---|---|
event |
Event | jQuery event object. |
request |
string | The request string. |
Example
apex.jQuery( apex.gPageContext$ ).on( "apexpagesubmit", function() {
var item = apex.item("P1_VALUE");
item.setValue( item.getValue().toUpperCase());
} );
This event is triggered at the end of all APEX page load functionality. This events differs from the standard page load event in that it will not only wait for the DOM to be ready, but also for any delayLoading components to be ready.
Please see the delayLoading property of the apex.item.create API for further information about items that can delay loading.
Properties:
Name | Type | Description |
---|---|---|
event |
Event | jQuery event object. |
Example
apex.jQuery( apex.gPageContext$ ).on( "apexreadyend", function( e ) {
// code here
} );
This event is triggered on the window a couple hundred milliseconds after the window stops resizing. Listen for this event to adjust or resize page content after the window is done resizing. In some cases this is a better alternative to the window resize event, which is triggered many times as the window is being resized, because it is triggered just once after the window stops resizing.
Properties:
Name | Type | Description |
---|---|---|
Event |
Event | jQuery event object |
Example
apex.jQuery( window ).on( "apexwindowresized", function( event ) {
var window$ = apex.jQuery( this ),
height = window$.height(),
width = window$.width();
// update page content based on new window height and width
});
(static) item(pNd) → {item}
Return an item interface that is used to access item related methods and properties.
Item plug-in developers can override much of the item behavior, by calling apex.item.create with their overrides.
Parameters:
Name | Type | Description |
---|---|---|
pNd |
Element | string | The DOM Element or string id (item name) of the item. |
Returns:
- Type
- item
Example
(static) region(pRegionId) → {region|null}
Return a region interface for the given region id. The returned region interface object can then be used to access region related functions and properties.
Region plug-in developers can define the behavior of their region by calling apex.region.create.
Parameters:
Name | Type | Description |
---|---|---|
pRegionId |
string | Region id or region static id. It is a best practice to give a region a Static ID if it is going to be used from JavaScript otherwise an internally generated id is used. The region id is substituted in the region template using the #REGION_STATIC_ID# string. The region id can be found by viewing the page source in the browser. |
Returns:
pRegionId
.
- Type
- region | null
Example
Determine if the user is or has been interacting with this web app using touch since the browser session began. Note: it is possible for the user to touch for the first time after this function is called.
It is rare to need know this information since the app should be designed to work for both touch and non-touch environments.
Returns:
- Type
- boolean