Class: ComponentBinding

Oracle® JavaScript Extension Toolkit (JET)
3.2.0

E87541-01

QuickNav

oj. ComponentBinding

Version:
  • 3.2.0
JQueryUI component binding for Knockout.js.

Constructor

new ComponentBinding(name, options)

To create a custom binding, use oj.ComponentBinding.create(). Using prototypal inheritance to extend oj.ComponentBinding is not supported.
Parameters:
Name Type Argument Description
name string | Array.<string> the name of the binding or an array of strings in case the binding needs to be registered under several names
options Object | string <optional>
<nullable>
property object
Source:
See:

Methods

<static> create(name, options) → {oj.ComponentBinding}

Creates a binding instance and registers it with Knockout.js
Parameters:
Name Type Argument Description
name string | Array.<string> the name of the binding or an array of strings in case the binding needs to be registered under several names
options Object | string <optional>
<nullable>
property object with the following fields:
  • {string} 'componentName' - name of the component Not specifying this parameter indicates that the binding should use the 'component' attribute on itself to determine the constructor name
  • {Function} 'afterCreate'- a callback invoked after the component instance has been created. The function will receive the following parameters:
    • {Element} element - DOM element associated with this binding
    • {Function} widgetConstructor - constructor for the JQueryUI widget created by this binding. The constructor is already bound to the associated JQuery element
    • {Function} valueAccessor - a JavaScript function that you can call to get a map of current binding attributes
    • {Object} allBindings - a JavaScript object that you can use to access all the model values bound to this DOM element
    • {Object} bindingContext - an object that holds the binding context available to this element's bindings. This object includes special properties including $parent, $parents, and $root that can be used to access data that is bound against ancestors of this context
  • {Function} 'beforeDestroy'- a callback invoked before the component instance is detroyed The function will receive the same parameters as the 'afterCreate' callback above.
When this parameter is specified as a string, it will be interpreted as a single 'componentName' option
Source:
Returns:
binding instance
Type
oj.ComponentBinding

<static> deliverChanges()

Delivers all accumulated component changes across all instances of this binding. Calling this method is optional - the changes will be delivered after a 1ms timeout if this method is never invoked. However, you may call this method to speed up component updates when the aplication code is done updating the view models.
Source:

<static> getDefaultInstance() → {oj.ComponentBinding}

Retrieves the default component binding instance registered with Knockout.js
Source:
Returns:
default binding instance
Type
oj.ComponentBinding

setupManagedAttributes(opts)

Sets up custom handling for attributes that will be managed by this binding instance
Parameters:
Name Type Description
opts Object property object with the following fields:
  • 'attributes' - string array of attribue names
  • {Function} 'init' - a function called when a managed attribute is initialized. The function will receive the following parameters:
    • {string} name - attribute name
    • {Object} value - attribute value
    • {Element} element - DOM element where this binding is being attached
    • {Function} widgetConstructor - constructor for the JQueryUI widget created by this binding. The constructor is already bound to the associated JQuery element
    • {Function} valueAccessor - a JavaScript function that you can call to get a map of current binding attributes
    • {Object} allBindings - a JavaScript object that you can use to access all the model values bound to this DOM element
    • {Object} bindingContext - an object that holds the binding context available to this element's bindings. This object includes special properties including $parent, $parents, and $root that can be used to access data that is bound against ancestors of this context
    The optional return value of the function is a name-to-value map of properties that should be set on the component
  • {Function} 'update' - a function called when a managed attribute is updated. The function will receive the same parameters as the 'init' callback above. The optional return value of the function is a name-to-value map of properties that should be set on the component at the time when other accumulated changes are delivered
  • {Function} 'afterCreate'- a callback invoked after the component instance has been created. The function will receive the following parameters:
    • {string} name - attribute name
    • {Element} element - DOM element associated with this binding
    • {Function} widgetConstructor - constructor for the JQueryUI widget created by this binding. The constructor is already bound to the associated JQuery element
    • {Function} valueAccessor - a JavaScript function that you can call to get a map of current binding attributes
    • {Object} allBindings - a JavaScript object that you can use to access all the model values bound to this DOM element
    • {Object} bindingContext - an object that holds the binding context available to this element's bindings. This object includes special properties including $parent, $parents, and $root that can be used to access data that is bound against ancestors of this context
  • {string} 'for' (optional) - a string representing component type or constructor name restricting the applicability of these managed attributes
  • {Array.} 'use' (optional) - an string array of component types whose managed attribute behavior should be used for the component type specified with the 'for' attribute
  • {Function} 'beforeDestroy'- a callback invoked before the component instance is detroyed The function will receive the same parameters as the 'afterCreate' callback above.
Source: