The apex.actions namespace contains global functions related to the Oracle Application Express actions facility. The methods and properties of the global actions context are also available in the apex.actions namespace but are documented with the actions interface.
- Since:
- 5.1
Functions
(static) createContext(pTypeName, pContext) → {actions}
Create a new actions interface object that is scoped to the given DOM element context. Any action buttons or other UI elements must be within the given pContext. Focus must be within pContext for keyboard shortcuts defined in this context to be recognized. A global context at document.body is created automatically and is accessed from apex.actions. The global context type name is "global".
Parameters:
Name | Type | Description |
---|---|---|
pTypeName |
string | Type name of the actions context. |
pContext |
Element | DOM element context that actions are scoped within. |
Returns:
- Type
- actions
Example
This example creates a context within the element with id
myLogger
with type name "logger". Actions can then be added to the
actions interface log1
.
var log1 = apex.actions.createContext( "logger", $("#myLogger")[0] );
(static) findContext(pTypeNameopt, pContext) → {actions}
Return the actions interface for a given context. The pTypeName is optional but if given must match the type name used when the context was created. This is not often needed because the actions object returned from createContext should be saved by any widget/component that created the context.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pTypeName |
string |
<optional> |
The type name of the actions context. |
pContext |
Element | DOM element context that actions are scoped within. |
Returns:
- Type
- actions
Examples
This example returns the context for the element with id
myLogger
and with type name "logger".
var log1 = apex.actions.findContext( "logger", $("#myLogger")[0] );
This example is the same as the previous one except it does not provide the type name.
var log1 = apex.actions.findContext( $("#myLogger")[0] );
(static) getContextsForType(pTypeName) → {Array.<actions>}
Return an array of all the actions context instances for a given type.
Parameters:
Name | Type | Description |
---|---|---|
pTypeName |
string | The type name of the actions contexts to return. |
Returns:
- Type
- Array.<actions>
Example
This example returns the contexts for type name "logger".
var loggers = apex.actions.getContextsForType( "logger" );
(static) getContextTypes() → {Array.<string>}
Return an array of all the actions context type names.
Returns:
- Type
- Array.<string>
Example
This example will log to the console the number of actions in each of the action contexts of all types on the page.
var i, j, types, type, contexts;
types = apex.actions.getContextTypes();
for ( i = 0; i < types.length; i++ ) { // for each context type
type = types[i];
contexts = apex.actions.getContextsForType( type );
for ( j = 0; j < contexts.length; j++ ) { // for each context instance
console.log("Action context type: " + type + " [" + j + "]. Actions: " + contexts[j].list().length );
}
}
(static) removeContext(pTypeName, pContext)
Remove an actions context that was created with apex.actions.createContext.
Parameters:
Name | Type | Description |
---|---|---|
pTypeName |
string | Type name of the actions context to remove. |
pContext |
Element | DOM element context that actions are scoped within. |
Example
This example removes the context for the element with id
myLogger
with type name "logger".
apex.actions.removeContext( "logger", $("#myLogger")[0] );
(static) shortcutSupport(pShortcutTypeopt) → {string|undefined}
Get or set the type of shortcut key support. The default is "sequence".
Note: The shortcut key support setting does not affect what shortcuts can be defined for actions but only how what the user types is recognized.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pShortcutType |
string |
<optional> |
One of "off", "single", "sequence". If not specified the current value is returned. |
Returns:
- Type
- string | undefined
Examples
Get the current setting.
apex.actions.shortcutSupport();
Turn off the ability to use shortcuts on the page for all action contexts.
apex.actions.shortcutSupport( "off" );
Disable shortcut sequences such as C,B.
apex.actions.shortcutSupport( "single" );