Class: Components

Oracle® JavaScript Extension Toolkit (JET)
3.2.0

E87541-01

QuickNav

oj. Components

Version:
  • 3.2.0
JET Component services

Constructor

new Components()

Source:

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
Source:
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 Description
callback Function 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
Source:
See:
Returns:
- dynamic property getter
Type
Object

<static> getComponentElementByNode(node) → {Element|?Node}

Retrieves the JET component element that the node is in.
Parameters:
Name Type Argument Description
node Element | ?Node <nullable>
DOM node
Source:
Returns:
componentElement - JET component element A component element is the DOM element on which the JET component is initialized. It could be a custom element, composite element or a JQueryUI element. The static methods take a component element, figure out what type it is and then use the appropriate syntax to make the specified method or property call.
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
Source:
Returns:
value of option
Type
*

<static> getDefaultOptions() → {Object}

Retrieves default option values for JET components. This method should only be used internally by JET.
Deprecated:
  • since version 2.2
    Source:
    See:
    Returns:
    default option values
    Type
    Object

    <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.
    Source:
    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
    Source:
    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}

    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
    Source:
    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.
    Source:
    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)

    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
    Source:

    <static> setDefaultOptions(options)

    Sets default options values for JET components.
    Parameters:
    Name Type Description
    options Object 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
    Source:
    See:

    <static> subtreeAttached(node)

    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 Description
    node Element the root of the subtree
    Source:
    See:

    <static> subtreeDetached(node)

    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 Description
    node Element the root of the subtree
    Source:
    See:

    <static> subtreeHidden(node)

    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 Description
    node Element the root of the subtree
    Source:
    See:

    <static> subtreeShown(node)

    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
    Parameters:
    Name Type Description
    node Element the root of the subtree
    Source:
    See: