Class: Components

Oracle® JavaScript Extension Toolkit (JET)
5.0.0

E90577-01

QuickNav

Components

Version:
  • 5.0.0
Since:
  • 1.0
Module:
  • ojcomponentcore
JET Component services

Constructor

new Components()

Methods

(static) callComponentMethod(componentElement, method, methodArguments) → {*}

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
*

(static) createDynamicPropertyGetter(callback) → {Object}

Creates a dynamic getter that can be used as a property value in oj.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) → {*}

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
*

(static) getNodeBySubId(componentElement, locator) → {*}

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
*

(static) getSubIdByNode(componentElement, node) → {*}

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
*

(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 * 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': oj.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 oj.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 Element <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 Element <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