Namespace: Components

Oracle® JavaScript Extension Toolkit (JET)
15.1.0

F83698-01

Since:
  • 1.0
Module:
  • ojcomponentcore

QuickNav

Description

JET Component services


Usage

Typescript Import Format
//This namespace exports multiple static methods or members. To import 
import * as Components from "ojs/ojcomponentcore";

//Now you can access the methods as Components.methodName and so on

For additional information visit:


Methods

(static) callComponentMethod(componentElement, method, methodArguments) : {any}

Calls the specified JET component element's method with the given arguments
Parameters:
Name Type Argument Description
componentElement Element <nullable>
JET component element
method string name of JET component element method to call
methodArguments * list of arguments to pass to method call
Returns:
Type
any

(static) createDynamicPropertyGetter(callback) : {Object}

Creates a dynamic getter that can be used as a property value in Components.setDefaultOptions()
Parameters:
Name Type Argument Description
callback function <not nullable>
dynamic property callback. The callback will receive a context object as a parameter. The following properties are currently supported on the context object:
  • containers - an array of component names of the current component's containers that require special behavior from their children
  • element - component's host DOM element
The callback should return the computed property value
See:
Returns:

- dynamic property getter

Type
Object

(static) getComponentElementByNode(node) : (nullable) {Element|Node}

Retrieves the JET component element that the node is in.
Parameters:
Name Type Argument Description
node Element | Node <nullable>
DOM node
Returns:

componentElement - JET component element A component element is the DOM element on which the JET component is initialized.

Type
Element | Node

(static) getComponentOption(componentElement, option) : {any}

Retrieves the specified option of the specified JET component element
Parameters:
Name Type Argument Description
componentElement Element <nullable>
JET component element
option string option to retrieve
Returns:

value of option

Type
any

(static) getNodeBySubId(componentElement, locator) : {any}

Returns the component DOM node indicated by the locator parameter.
Parameters:
Name Type Argument Description
componentElement Element <nullable>
JET component element
locator Object Object containing, at minimum, a subId property, whose value is a string that identifies a particular DOM node in this component.
Returns:

node - The DOM node located by the locator, or null if none is found

Type
any

(static) getSubIdByNode(componentElement, node) : {any}

Retrieves the subId of the node as as part of a locator object i.e. at least {subId: subIdOfNode}
Parameters:
Name Type Argument Description
componentElement Element <nullable>
JET component element
node Element <nullable>
DOM node
Returns:

locator - object with at least a subId or null if the node does not have a subId

Type
any

(static) getWidgetConstructor(element, widgetName) : {(function()|null)}

This method should only be used for JQueryUI components and will return null if used with a custom element. Retrieves widget constructor associated with the HTML element or null if none is found. The returned constructor is already bound to the associated JQuery element, so it can be invoked as a function directly. For example:
widgetConstructor("option", "label", "custom"); // sets label option
If widgetName is not specified, and if more than one widget is associated with the element, the method will a return the widget that was created first.
Parameters:
Name Type Argument Description
element Element | Node <nullable>
HTML element
widgetName string <optional>
optional widget name
Returns:

widget constructor

Type
function | null

(static) isComponentInitialized(jelement, widgetName) : {boolean}

Determines if a component identified by the widgetName has been bound and initialized on a given jelement.
Parameters:
Name Type Description
jelement jQuery to which the component is bound
widgetName string constructor name of the target component.
Returns:

true if the component identified by the widgetName has be bound and initialized to the target element.

Type
boolean

(static) setComponentOption(componentElement, option, value) : {void}

Sets the specified option of the specified JET component element to the specified value
Parameters:
Name Type Argument Description
componentElement Element <nullable>
JET component element
option string option to set
value any value to set option to
Returns:
Type
void

(static) setDefaultOptions(options) : {void}

Sets default options values for JET components.
Parameters:
Name Type Argument Description
options Object <not nullable>
property values that will be merged into the values that were previously set using this method. The options object is expected to have the format demonstrated by the following example:
{
  'default': // properties for all JET components
  {
    'option1': 'somevalue'
  },
  'editableValue': // properties for editableValue components
  {
    'option1': 'somevalue1',
    'option2': Components.createDynamicPropertyGetter(function(context){
                                return context['containers'].indexOf('ojTable') >= 0 ? 'tableValue' : 'normalValue'})
  },
  'ojText': // properties for instances of ojText
  {
    'option1': 'somevalue2'
  }
}
To specify a dynamic getter for the property, pass your callback to Components.createDynamicPropertyGetter(). Note that dynamic getters nested within a complex property value are not supported
See:
Returns:
Type
void

(static) subtreeAttached(node) : {void}

Notifies JET framework that a subtree possibly containing JET components has been inserted into the document programmatically. Note that there is no need to call this method when the new DOM is being inserted by the template engine in Knockout.js
Parameters:
Name Type Argument Description
node Element <not nullable>
the root of the subtree
See:
Returns:
Type
void

(static) subtreeDetached(node) : {void}

Notifies JET framework that a subtree possibly containing JET components has been removed from the document programmatically. Note that calling this method is not needs after calling JQuery's .remove() because all JET components would have been already destroyed in that case. Similarly, there is no need to call this method after the subtree has been removed by Knockout.js
Parameters:
Name Type Argument Description
node Element <not nullable>
the root of the subtree
See:
Returns:
Type
void

(static) subtreeHidden(node) : {void}

Notifies JET framework that a subtree possibly containing JET components has been hidden with display:none style This method should be called by the application after the subtree has been hidden programmatically, such as when JQuery's .hide() method is called.
Parameters:
Name Type Argument Description
node Node <not nullable>
the root of the subtree
See:
Returns:
Type
void

(static) subtreeShown(node, options) : {void}

Notifies JET framework that a subtree possibly containing JET components is no longer hidden with display:none style This method should be called by the application if the 'display' style is being changed from 'hidden' programmatically, such as when JQuery's .show() method is called. For cases where subtree is shown on initial render, this method should be called with the options parameter set to {'initialRender':true}, that will result in _NotifyInitShown() calls to the subtree components. All oj-defer elements in the entire subtree will be activated. Note that subtreeShown currently notifies the entire subtree as well. This generally means that only non-nested oj-defer elements make sense in a subtree.
Parameters:
Name Type Argument Description
node Node <not nullable>
the root of the subtree
options Object <optional>
Options to control subtreeShown
Properties
Name Type Description
initialRender boolean The index at which to start fetching records.
See:
Returns:
Type
void