Class: ojSelect

Oracle® Fusion Middleware Oracle JavaScript Extension Toolkit (JET)
12c (12.1.4)

E54107-01

QuickNav

oj. ojSelect extends oj.editableValue

JET Select Component

Description: JET Select enhances a html select and option elements into a Select that supports single-select and search filtering. Note: the 'multiple' option is not supported in V1.

A JET Select can be created with the following markup. By default, it creates a single-select Select.


<select data-bind="ojComponent: {component: 'ojSelect'}">
    <option value="option 1">option 1</option>
    <option value="option 2">option 2</option>
    <option value="option 3">option 3</option>
    <option value="option 4">option 4</option>
</select>

Keyboard interaction

When the focus is in the select element

Key Use
Enter Select the highlighted choice.
Tab Select the highlighted choice.
UpArrow or DownArrow Highlight the option item on the drop down list in the direction of the arrow. If the drop down is not open, expand the drop down list.
Esc Collapse the drop down list. If the drop down is already closed, do nothing.

Disabled option items receive no highlight and are not selectable.

Reading direction

As with any JET component, in the unusual case that the directionality (LTR or RTL) changes post-init, the Select must be refresh()ed.

Pseudo-selectors

The :oj-select pseudo-selector can be used in jQuery expressions to select JET Select. For example:

$( ":oj-select" ) // selects all JET Select on the page
$myEventTarget.closest( ":oj-select" ) // selects the closest ancestor that is a JET Select

JET for jQuery UI developers

Event names for all JET components are prefixed with "oj", instead of component-specific prefixes like "Select".

Constructor

new ojSelect()

Creates a JET Select.
Source:
Examples

Initialize the Select with no options specified:

$( ".selector" ).ojSelect();

Initialize the Select with some options:

$( ".selector" ).ojSelect( { "placeholder": "Select a value." } );

Initialize the Select via the JET ojComponent binding:

<div id="select" data-bind="ojComponent: { component: 'ojSelect' }">

Fields

#contextMenu :Object

JQ selector identifying the JET Menu that the component should launch as a context menu on right-click or Shift-F10. If specified, the browser's native context menu will be replaced by the specified JET Menu.

To specify a JET context menu on a DOM element that is not a JET component, see the ojContextMenu binding.

To make the page semantically accurate from the outset, applications are encouraged to specify the context menu via the standard HTML5 syntax shown in the below example. When the component is initialized, the context menu thus specified will be set on the component.

The JET Menu should be initialized before any component using it as a context menu.

Default Value:
  • null
Inherited From:
Source:
Examples

Initialize a JET component with a context menu:

// via recommended HTML5 syntax:
<div id="myComponent" contextmenu="myMenu" data-bind="ojComponent: { ... }>

// via JET initializer (less preferred) :
$( ".selector" ).ojFoo({ "contextMenu": "#myMenu" });

Get or set the contextMenu option, after initialization:

// getter
var menu = $( ".selector" ).ojFoo( "option", "contextMenu" );

// setter
$( ".selector" ).ojFoo( "option", "contextMenu", ".my-marker-class" );

Set a JET context menu on an ordinary HTML element:

<a href="#" id="myAnchor" contextmenu="myMenu" data-bind="ojContextMenu: {}">Some text

#converter :string|Object|undefined

a converter instance, where each instance duck types oj.Converter, or an converter object literal containing the following name value pair.
  • type: the string conveter type registered with the ConverterFactory. Supported types are 'number' and 'datetime'
  • options: an optional Object literal of options that the converter expects.
If the converter option changes after the component has been initialized then
- if the component is valid, the value option is formatted using the new converter instance and the display updated with the new value.
- otoh, if the component is invalid when the converter option changed, it is the responsibility of the page author to clear messages on the component and reset the value if needed.
Inherited From:
Source:
Examples

Initialize the component with converter object literal:

$(".selector").ojInputText({
  value: 25000,
  converter: {
    type: 'number', 
    options : {
      style: 'currency', 
      currency: 'USD', 
      maximumFractionDigits: 0
    }
  }
});

Initialize the component with a number converter instance:

// Initialize converter instance using currency options
var options = {style: 'currency', 'currency': 'USD', maximumFractionDigits: 0};
var numberConverterFactory = oj.Validation.converterFactory("number");
var salaryConverter = numberConverterFactory.createConverter(options);
// set converter instance using converter option $(".selector").ojInputText({ value: 25000, converter: salaryConverter });

#data :Array

The data for the Select. Instead of providing a list of option items, the data can be specified as an array of objects containing id and text. The id is used as the value of the option item and text as the label.
Source:
Example

Initialize the Select with the data option specified:

$( ".selector" ).ojSelect( { "data": [{id: 'option1', text: 'option1'}, {id: 'option2', text: 'option2'}, {id: 'option3', text: 'option3'},] } );

#disabled :boolean|undefined

whether the component is disabled.

The 2-way disabled binding offered by the ojComponent binding should be used instead of Knockout's built-in disable and enable bindings, as the former sets the API, while the latter sets the underlying DOM attribute.

Default Value:
  • false. The element's disabled property is used as its initial value if it exists, when the option is not explicitly set. When neither is set, disabled defaults to false.
Inherited From:
Source:
Example

Initialize component with disabled option:

$(".selector").ojInputText({"disabled": true});

#help :Object.<string, string>

The help information that goes on the label. When help is set on the input component, then help information is added to the input's label. The help options are:
  • definition - this is the help definition text. It is what shows up when the user hovers over the label or the help icon.
  • source - this is the help source url. If present, a help icon will render next to the label and the anchor's target is this source.
Default Value:
  • { "definition":"some help definition, "source":"some external url" }
Inherited From:
Source:
Examples

Initialize the input with the help definition and external url information:

$( ".selector" ).ojRadioset({ "help": {"definition":"some help definition, "source":"some external url" } });

Set the help option, after initialization:

// setter
$( ".selector" ).ojRadioset( "option", "help", {"definition":"fill out the name", "source":"http:\\www.oracle.com" } );

#messages :Array|undefined

an array of messages for this component, each instance of type oj.Message or an object that duck types it.
Default Value:
  • initializes to an empty array when no option is set.
Inherited From:
Source:
Examples

Get the current set of messages for the component:

var messages = $(".selector").ojInputText("option", "messages");

Clear all messages set on the component:

$(".selector").ojInputText("option", "messages", []);

Add a message (of default error severity) to the component using the messages option:

var msgs = [];
msgs.push({'summary': 'Error Summary', 'detail': 'Error Detail'}); 
$(".selector").ojInputText("option", "messages", msgs);

Set a oj.Message instance to the component:

var message = new oj.Message("summary text", "detail text");
var messagesArr = [message];
$(".selector").ojInputText("option", "messages", messagesArr);

#messagingDisplayOptions :Object|undefined

an Object literal containing the following property-value pairs, that allows a widget to specify how it wants various 'messaging artifacts' to be displayed in relation to itself.
Accepted values for the key is a string type of the messaging artifact and they include 'messages', 'converterHint', 'validatorHint', 'title'.
The value is either an array of display options or a string display option. When an array of display options is specified the first display option is used first and then the second as fallback and so on. NOTE: In the future we plan to support additional display options like 'inline'.
Properties:
Name Type Argument Description
converterHint string <optional>
supported values are 'placeholder', 'notewindow', 'none'. E.g. {'converterHint': ['placeholder', 'notewindow']}
validatorHint string <optional>
supported values are 'notewindow', 'none'. E.g. {'validatorHint': ['notewindow']}
messages string <optional>
supported values are 'notewindow', 'none'. E.g. {'messages': 'notewindow'}
title string <optional>
supported values are 'notewindow', 'none'. E.g. {'title': 'notewindow'}
Default Value:
  • { 'messages': ['notewindow'], 'converterHint': ['placeholder', 'notewindow'], 'validatorHint': ['notewindow'], 'title': ['notewindow'] }
Inherited From:
Source:
Example

Initialize component and override default for converterHint using messagingDisplayOptions:

// Only messages will get shown in the notewindow associated to this component
$(".selector").ojInputText("option", "messagingDisplayOptions", {
  'converterHint': ['notewindow'] // the default is ['placeholder', 'notewindow']
});

#minimumResultsForSearch :number

The threshold for showing the search box in the dropdown when it's expanded. The search box is always displayed when the results size is greater than the threshold, otherwise the search box is initially turned off. However, the search box is displayed as soon as the user starts typing. This property only applies to single-select.
Default Value:
  • 10
Source:

#placeholder :string

The placeholder text. When placeholder is used for a single value select, it requires that you include an empty tag as your first option.
Source:
Example

Initialize the select with the placeholder option specified:

$( ".selector" ).ojSelect( { "placeholder": "Please select ..." } );

#required :string|undefined

whether the component is required. Allowed values for required are 'required' and 'optional', 'optional' being the default.
When required option is set, the input's label will render a required icon.
When required option is set, a required validator - (@link oj.RequiredValidator) - is implicitly used. If an explicit required validator is set using the validators option then that gets used instead.
Default Value:
  • when the option is not set, the element's required property is used as its initial value if it exists.
Inherited From:
Source:
Examples

Initialize the component with the required option:

$(".selector").ojInputNumber({required: 'required'});

Initialize required otpion from html attribute 'required':

<input type="text" value= "foobar" required/>
// reading the required option will return "required" $(".selector").ojInputNumber("option", "required");

Using required option and setting an explicit required validator:

<input type="text" value="foobar" required data-bind="ojComponent: {
  component: 'ojInputText', 
  value: password, 
  validators: [{type: 'required', options : {
                               messageSummary: '\'{label}\' Required', 
                               messageDetail: 'A value is required for this field'}}]}"/>

#rootAttributes :Object|undefined

Attributes specified here will be set on the component's root DOM element at creation time. This is particularly useful for components like Dialog that wrap themselves in a root element at creation time.

The specified class and style are appended to the current class and style, respectively. All other attributes overwrite any existing value.

Setting this option after component creation has no effect.

Default Value:
  • undefined
Inherited From:
Source:
Example

Initialize a JET component, specifying a set of attributes to be set on the component's root DOM element:

$( ".selector" ).ojFoo({ "rootAttributes": {
  'id': 'myId', 
  'style': 'max-width:100%; color:blue;', 
  'class': 'my-class'
}});

#title :string|undefined

represents advisory information for the component, such as would be appropriate for a tooltip.
Default Value:
  • when the option is not set, the element's title attribute is used as its initial value if it exists.
Inherited From:
Source:
Examples

Initialize the component with the title option:

<input id="username" type="text" data-bind="
   ojComponent: {component: 'ojInputText', title : 'enter at least 3 alphanumeric characters', 
                 pattern: '[a-zA-Z0-9]{3,}', value: ''}"/>

Initialize title option from html attribute 'title':

<input id="username" type="text" value= "foobar" title="enter at least 3 alphanumeric characters" 
          pattern="[a-zA-Z0-9]{3,}"/>
$("#username").ojInputText({}); // reading the title option will return "enter at least 3 alphanumeric characters" $("#username").ojInputText("option", "title");

#validators :Array|undefined

an array of validator instances, where each instance duck types oj.Validator, or an array of validator object literals where each object contains the following name value pairs.
  • type: a string validator type that is registered with the oj.ValidatorFactory. An instance is created using the factory method on @link oj.ValidatorFactory.
  • options: an optional Object literal of options that the validator expects.
After the component has been initialized with validators, changing the validators on the component can present issues that need to addressed appropriately
- if the component is valid, the current value that passed validations before may now start failing. E.g, if value was below a certain max value but a new validator lowered the max value, invalidating the current value. In such cases the page author has the option of calling the validate() method to re-run validators against the current value. In some cases it may be necessary to re-initialize the component.
- if the component was invalid when the validators changed, again it may be necessary to for the page author to clear messages on the component, or in some cases re-initialize the component might be necessary.
Inherited From:
Source:
Examples

Initialize the component with validator object literal:

$(".selector").ojInputNumber({
  validators: [{
    type: 'numberRange', 
    options : {
      hint: {hintMinimum: 'Enter a value greater than '{min}'}, 
      min: 100
    }
  }],
});
NOTE: oj.Validation.validatorFactory('numberRange') returns the validator factory that is used 
to instantiate a numberRange validator.

Initialize the component with multiple validator instances:

var validator1 = new MyCustomValidator({'foo': 'A'}); 
var validator2 = new MyCustomValidator({'foo': 'B'});
$(".selector").ojInputNumber({
  value: 10, 
  validators: [validator1, validator2]
});

#value :Object|undefined

The value of the editable component.
Default Value:
  • When the option is not set, the element's value property is used as its initial value if it exists. The type of value is as defined by the component that extends this class. Refer to specific components for defaults.
Inherited From:
Source:
Examples

Initialize the component with the value option specified:

$(".selector").ojInputNumber({'value': 10});

Get or set the value option, after initialization:

// Getter: returns 10
$(".selector").ojInputNumber("option", "value");
// Setter: sets 20
$(".selector").ojInputNumber("option", "value", 20);

Events

#expand

Triggered after the Select drop down has been expanded.
Properties:
Name Type Description
event Event jQuery event object
ui Object Parameters
Source:
Examples

Initialize the Select with the expand callback specified:

$( ".selector" ).ojSelect({
    "expand": function( event ) {}
});

Bind an event listener to the ojexpand event:

$( ".selector" ).on( "ojexpand", function( event ) {} );

#optionChange

Triggered when the following component options change.
  • messages: a component's validity changes when its messages changes. For example -
    • when it goes from valid with no messages, to invalid with messages (of severity fatal or error), or to valid with messages (of severity warning, info or confirmation).
    • when it goes from valid with messages, to valid with a new set of messages, or to valid with no messages, or to invalid with messages
    • when it goes from invalid with messages, to invalid with new set of messages, or to valid with no messages, or to valid with messages (of severity warning or lower).
  • value: when the component's value changes.

The event payload has the following properties -

Properties:
Name Type Description
event Event jQuery event object
data Object event payload
Properties
Name Type Description
option string the name of the option that changed, i.e. "messages" or "value"
previousValue Object an Object holding the previous value of the option
value Object an Object holding the current value of the option
optionMetadata Object an Object literal that provides metadata for the option.
Inherited From:
Source:
Examples

Initialize the ojInputText component with the optionChange callback to be notified of changes to the component's validity

$(".selector").ojInputText({
  'optionChange': function (event, data) {} 
});

Bind an event listener to the ojoptionchange event

$(".selector").on({
  'ojoptionchange': function (event, data) {
      window.console.log("option changing is: " + data['option']);
  };
});

Methods

#_SetPlaceholder(value)

Sets the placeholder text on the content element by default. It sets the placeholder attribute on the element. Component subclasses can override this method to control where placeholder text gets set.
Parameters:
Name Type Description
value string
Source:

#collapse()

Collapses the drop down list. This method does not accept any arguments.
Source:

#expand()

Expands the drop down list. This method does not accept any arguments.
Source:

#getNodeBySubId(locator) → {Element|null}

Return the subcomponent node represented by the documented locator attribute values. Test authors should target sub elements using the following names:
  • oj-select-chosen: the selected text in the select box
  • oj-select-search: the search box. Note the searchbox is not always visible
  • oj-select-drop: the drop down box
  • oj-select-results: the filtered result list
Parameters:
Name Type Description
locator Object An Object containing at minimum a subId property whose value is a string, documented by the component, that allows the component to look up the subcomponent associated with that string. It contains:

component: optional - in the future there may be more than one component contained within a page element

subId: the string, documented by the component, that the component expects in getNodeBySubId to locate a particular subcomponent

Source:
Returns:
the subcomponent located by the subId string passed in locator, if found.

Type
Element | null

#getSubIdByNode(node) → {string|null}

Return the subId string for the given child DOM node
Parameters:
Name Type Description
node Element child DOM node
Inherited From:
Source:
Returns:
- the subId for the DOM node or null when none is found
Type
string | null

#isValid() → {boolean}

whether the component is currently valid.
Inherited From:
Source:
Returns:
Type
boolean
Example

Check whether the component is valid:

var value = $(".selector").ojInputText("isValid");

option(key, value)

Reacts to changes to the 'value' or 'messages' option by triggering a 'optionChange' event if the value changes from its previous value. Refer to the optionChange event for details.
Parameters:
Name Type Argument Description
key String | Object | string <optional>
a single string representing a key or an object representing a group of options
value Object <optional>
of the key
Inherited From:
Source:
Fires:

#refresh()

Refreshes the visual state of the tabs. JET components require a refresh() or re-init after the DOM is programmatically changed underneath the component.

This method does not accept any arguments.

Source:

#validate(requiredOnly)

A convenience method to validate the option value after it is set programmatically using the option setter.
When the value property is set, it's expected to be of the correct type as defined by the component. To run the value through the validators, this method can be called. When there are no validators setup for the component this method is a no-op and returns true. When there is at least one validator the first one that fails, updates the component validity, adds messages and triggers the optionChange event.
Callers should explicitly clear messages when calling this method.
Parameters:
Name Type Description
requiredOnly boolean If true only runs the required-ness check.
Inherited From:
Source:
Example

Validate the value option.

// set value
$(.selector).ojInputDate('option', 'value', new Date());
// clear current messages on component
$(.selector).ojInputText('option', 'messages', []);
// validate value. validation errors are displayed if any based on the messagingDisplayOptions.
$(.selector).ojInputText('validate');

#widget() → {jQuery}

Returns a jQuery object containing the element visually representing the select.

This method does not accept any arguments.

Source:
Returns:
the select
Type
jQuery

Non-public Methods

<protected, static> _GetDefaultStyleClass() → {string}

Returns the default styleclass for the component. Currently this is used to pass to the _ojLabel component, which will append -label and add the style class onto the label. This way we can style the label specific to the input component. For example, for inline labels, the radioset/checkboxset components need to have margin-top:0, whereas all the other inputs need it to be .5em. So we'll have a special margin-top style for .oj-label-inline.oj-radioset-label All input components must override
Source:
Returns:
Type
string

<protected, static> _GetMessagingLauncherElement()

Returns the messaging launcher element
Source:

<protected, static> _setOption()

Handles options specific to select.
Source:

<protected> #_AfterCreate()

The value option alone is initialized here since it requires the component to be fully created. Calling this.options.value before this method does not guarantee the correct value to be returned.
Inherited From:
Source:

<protected> #_CanSetValue()

Whether the a value can be set on the component. If the component is disabled then setting value on component is a no-op.
Inherited From:
Source:
See:

<protected> #_ComponentCreate()

Initializes options defined by this base class.
Inherited From:
Source:

<protected> #_destroy()

Detaches the widget from the element and restores element exactly like it was before the widget was attached.
Inherited From:
Source:

<protected> #_GetAllValidators() → {Array}

Returns an array of all validators built by merging the validators option set on the component and the default validators setup by the component.
This does not include the default required validator. Components can override to add to this array of validators.
Inherited From:
Source:
Returns:
of validators
Type
Array

<protected> #_GetContentElement() → {Object}

Returns a jquery object of the element representing the content node. This could be a jQuery object of the element the widget was invoked on - typically this is an input or select or textarea element for which a value can be set.
Inherited From:
Source:
Returns:
the jquery element that represents the editable content. E.g., an input
Type
Object

<protected> #_GetConverter() → {Object}

Returns the normalized converter instance.
Inherited From:
Source:
Returns:
a converter instance or null
Type
Object

<protected> #_GetDefaultStyleClass() → {string}

Returns the default styleclass for the component. Currently this is used to pass to the _ojLabel component, which will append -label and add the style class onto the label. This way we can style the label specific to the input component. For example, for inline labels, the radioset/checkboxset components need to have margin-top:0, whereas all the other inputs need it to be .5em. So we'll have a special margin-top style for .oj-label-inline.oj-radioset-label All input components must override
Inherited From:
Source:
Returns:
Type
string

<protected> #_GetDefaultValidators() → {Object}

Returns an array of default validators used by component. The list of default validators are for the internal use of the component and are not a part of this.options.validators. E.g., if the pattern attribute or option is set, a RegExpValidator instance is automatically created and added to this list. RequiredValidtor is tracked separately from the default validators.
Inherited From:
Source:
Returns:
a map of string name to the validator instance.
Type
Object

<protected> #_GetDisplayValue(value) → {string}

Returns the display value that is ready to be passed to the converter.
Parameters:
Name Type Description
value Object the stored value if available that needs to be formatted for display
Inherited From:
Source:
Returns:
usually a string display value
Type
string

<protected> #_GetElementValue()

Returns the element's value. Normally, this is a call to this.element.val(), but for some components, it could be something else. E.g., for ojRadioset the element's value is really the value of the selected radio in the set.
Inherited From:
Source:

<protected> #_GetLabelElement() → {Object}

Returns a jquery object of the element representing the primary label node for the input component. First we look for the aria-labelledby attribute on the input. If that's not found, we look for the label with 'for' attribute pointing to input. If that's not found, we walk up the dom looking for aria-labelledby.
Inherited From:
Source:
Returns:
the jquery element that represents the input component's label. return null if it can't find anything.
Type
Object

<protected> #_GetMessagingLauncherElement() → {Object}

Returns a jquery object of the element that triggers messaging behavior. The trigger element is usually an input or select or textarea element for which a value can be set/retrieved and validated.
Inherited From:
Source:
Returns:
jquery object
Type
Object

<protected> #_GetMessagingLauncherElement() → {Object}

Returns a jquery object of the element that triggers messaging behavior. The trigger element is usually an input or select or textarea element for which a value can be set/retrieved and validated.
Inherited From:
Source:
Returns:
jquery object
Type
Object

<protected> #_GetReadingDirection() → {string}

Determines whether the component is LTR or RTL.

Component responsibilities:

  • All components must determine directionality exclusively by calling this protected superclass method. (So that any future updates to the logic can be made in this one place.)
  • Components that need to know the directionality must call this method from _create() and refresh(), and cache the value.
  • Components should not call this at other times, and should instead use the cached value. (This avoids constant DOM queries, and avoids any future issues if directional islands and component reparenting (e.g. popups) should coexist.)

App responsibilities:

  • The app specifies directionality by setting the HTML "dir" attribute on the <html> node. When omitted, the default is "ltr". (Per-component directionality / directional islands are not currently supported due to inadequate CSS support.)
  • As with any DOM change, the app must refresh() the component if the directionality changes dynamically. (This provides a hook for component housekeeping, and allows caching.)
Default Value:
  • "ltr"
Inherited From:
Source:
Returns:
the reading direction, either "ltr" or "rtl"
Type
string

<protected> #_GetSavedAttributes(element) → {Object}

Gets the saved attributes for the provided element. This is usually the original list of attributes set on the element.
Parameters:
Name Type Description
element Object jQuery selection, should be a single entry
Inherited From:
Source:
Returns:
savedAttributes - attributes that were saved for this element.
Type
Object

<protected> #_HandleChangeEvent(event)

Convenience handler for the DOM 'change' event. Subclasses are expected to wire up event handlers for DOM events that they wish to handle.
The implementation retrieves the display value for the component by calling _GetDisplayValue() and calls _SetValue(), with full validation.
Parameters:
Name Type Description
event Event DOM event
Inherited From:
Source:

<protected> #_InitOptions()

Called at component create time primarily to initialize options, often using DOM values. This method is called before _ComponentCreate is called, so components that override this method should be aware that the component has not been rendered yet. The element DOM is available and can be relied on to retrieve any default values.

This method sets defaults for its options that have a DOM namesake. E.g., value, required, disabled etc. Subclasses can override this method to set their own defaults for these options. Example, the value option is often not set on this.element for components like radioset, which walk the sub-tree to determine the value.

Inherited From:
Source:

<protected> #_IsRequired() → {boolean}

Whether the component is required.
Inherited From:
Source:
Returns:
true if required; false
Type
boolean

<protected> #_Refresh(name, value, fullRefresh)

Called in response to a change in the options set for this component, this method refreshes the component display value. Subclasses can override to provide custom refresh behavior.
Parameters:
Name Type Argument Description
name String <optional>
the name of the option that was changed
value Object <optional>
the current value of the option
fullRefresh boolean <optional>
false is the default; true means always refresh component display value
Inherited From:
Source:

<protected> #_RefreshAriaRequired(value)

Called when a aria-required attribute needs to be set or removed. Most inputs/selects need aria-required on the input element (aka 'content') But it is not legal to have aria-required on radio/checkboxes. Subclasses can override to put aria-required where they want.
Parameters:
Name Type Argument Description
value Object <optional>
the current value of the required option
Inherited From:
Source:

<protected> #_ResetAllValidators()

EditableValue caches the validators to be run within this.__allValidators variable. This is great; however when the default validators need to be reset [i.e. min + max changing] then the cached this.__allValidators needs to be cleared out. This method also updates the messaging strategies as hints associated with validators could have changed.
Inherited From:
Source:

<protected> #_RestoreAttributes()

Restores the saved element's attributes
Inherited From:
Source:

<protected> #_SaveAttributes(element)

Saves the element's attributes within an internal variable to be reset during the destroy function The JSON variable will be held as : [ { "element" : element[i], "attributes" : { attributes[m]["name"] : {"attr": attributes[m]["value"], "prop": $(element[i]).prop(attributes[m]["name"]) } } ]
Parameters:
Name Type Description
element Object jQuery selection to save attributes for
Inherited From:
Source:

<protected> #_SetDisplayValue(displayValue)

Called when the display value on the element needs to be updated. This method updates the (content) element value. Widgets can override this method to update the element appropriately.
Parameters:
Name Type Description
displayValue String of the new string to be displayed
Inherited From:
Source:

<protected> #_setOption(name, value)

Called (by the widget factory) when the option changes, this method responds to the change by refreshing the component if needed. This method is not called for the options passed in during the creation of the widget.
Parameters:
Name Type Description
name string of the option
value Object | string
Inherited From:
Source:

<protected> #_SetRootAttributes()

Reads the rootAttributes option, and sets the root attributes on the component's root DOM element.

class and style are appended to the current class and style, respectively. All other attributes overwrite any existing value.

Inherited From:
Source:

<protected> #_SetValue(newValue, event, options) → {boolean}

Sets the value on the component after clearing existing messages on the component. This method is typically called when a component needs to write a user value into the component.
Parameters:
Name Type Argument Description
newValue Object the value to be set.
event Object <optional>
an optional event if this was a result of ui interaction. For user initiated actions that trigger a DOM event, passing this event is required. E.g., if user action causes a 'blur' event.
When _SetValue is called as a result of a programmatic update, such as calling a method on a component, then the event can be undefined. E.g., ojInputNumber.stepUp()
options {validationMode:number} <optional>
an Object literal that callers pass in to determine how validation gets run. Keys and values to pass in options are as follows: 'validationMode': {number} Accepted values (defined in _VALIDATION_MODE) are -
  • FULL - the default and runs both the converter and all validators.
  • VALIDATORS_ONLY - runs all validators including the required validator is run.
  • REQUIRED_VALIDATOR_ONLY - runs just the required validator.
  • NONE - runs no validation and write the value to the options.
NOTE: All options expect NONE will clear current messages.
  • If validation is to be run, then the newValue is compared with the last element value. If it's the same then validation is skipped. If not the same validation continues.
  • When there is a validation error, value option not set and the method returns false.
  • If all validations pass, and the new parsed value is the same as the options.value then the value option is not written, the component display is refreshed and the method returns true. But if the new value is different then it's written to the options and the component refreshed
Inherited From:
Source:
Returns:
false if value was not set due to validation error.
Type
boolean

<protected> #_TriggerOptionChange(option, previousValue, originalEvent)

Triggers a 'optionChange' event on the component. The payload is the previous and current values for the option that changed. Currently supported options that trigger this event are value and messages.
Parameters:
Name Type Argument Description
option string name of the option that changed
previousValue string | number | Object an array of the previous
originalEvent Event <optional>
the original dom event that triggered the validation. If this is set then writeback happens.
Inherited From:
Source:

<protected> #_ValueEquals(value1, value2) → {boolean}

Compares 2 values for equality and returns true if they are equal; false otherwise. Calls oj.Object.innerEquals() which works for most Javascript data types.
Parameters:
Name Type Description
value1 Object | string | undefined first value
value2 Object | string | undefined another value
Inherited From:
Source:
Returns:
Type
boolean