Element: <oj-combobox-one>

Oracle® JavaScript Extension Toolkit (JET)
7.1.0

F18183-01

Signature:

class ojComboboxOne<K, D, V= any>

QuickNav

Attributes

JET Custom Elements

JET components are implemented as custom HTML elements. In addition to the component attributes documented in this page, JET components also support standard HTML global attributes like id and aria-label.

The JET data binding syntax can be used to define both component and global attributes through the use of dynamically evaluated expressions. All attributes (component and global) support attribute-level binding by prefixing the attribute name with ":" (e.g. :id="[...]"). When using attribute-level binding, all expression values are treated as strings. Additionally, component attributes support property-level binding by using the attribute name directly with no ":" prefix. When using property-level binding, the expressions should evaluate to the types documented by the corresponding attributes. Property-level binding is strongly recommended over attribute-level binding for component attributes.

A detailed description of working with custom HTML elements can be found in: JET Custom Element Usage.



PREVIEW: This is a preview API. Preview APIs are production quality, but can be changed on a major version without a deprecation path.

Version:
  • 7.1.0
Since:
  • 0.6.0
Module:
  • ojselectcombobox

Module usage

See JET Module Loading for an overview of module usage within JET.

Typescript Import Format
//To typecheck the element APIs, import as below.
import {ojComboboxOne} from "ojs/ojselectcombobox";

//For the transpiled javascript to load the element's module, import as below
import "ojs/ojselectcombobox";
Generic Parameters
ParameterDescription
KType of key of the dataprovider
DType of data from the dataprovider
VType of value of the component

JET In Typescript

A detailed description of working with JET elements and classes in your typescript project can be found at: JET Typescript Usage.


JET Combobox One

Description: JET Combobox One provides support for single-select, text input, and search filtering.

A JET Combobox One can be created with the following markup.


<oj-combobox-one>
  <oj-option value="option 1">option 1</oj-option>
  <oj-option value="option 2">option 2</oj-option>
  <oj-option value="option 3">option 3</oj-option>
  <oj-option value="option 4">option 4</oj-option>
</oj-combobox-one>

Validation and Messaging

An editable component runs validation (normal or deferred) based on the action performed on it (either by end-user or page author), and the state it was in when the action occurred. Examples of actions are - creating a component, user changing the value of the component by interacting with it, the app setting a value programmatically, the app calling the validate() method etc. At the time the action occurs, the component could already be showing errors, or can have a deferred error or have no errors.

These factors also determine whether validation errors/messages get shown to the user immediately or get deferred. The following sections highlight the kinds of validation that are run and how messages get handled.

Normal Validation

Normal validation is run in the following cases on the display value, using the converter and validators (this includes async-validators) set on the component, and validation errors are reported to user immediately.
  • When value changes as a result of user interaction all messages are cleared, including custom messages added by the app, and full validation is run on the UI value. The steps performed are outlined below.
    1. All messages are cleared and messagesCustom property is cleared
    2. If no converter is present then processing continues to next step. If a converter is present, the UI value is first converted (i.e., parsed). If there is a parse error then the messages are shown and processing returns.
    3. If there are no validators setup for the component then the value is set on the component. Otherwise all validators are run in sequence using the parsed value from the previous step. The implicit required is run first if the component is marked required. When a validation error is encountered it is remembered and the next validator in the sequence is run.
      • NOTE: The value is trimmed before required validation is run
    4. At the end of the validation run if there are errors, the messages are shown and processing returns. If there are async-validators, those errors are shown as soon as they come in, and not until all validators, sync and async validators, are complete, does processing return, that is, value and valid are updated. If there are no errors, then the value property is updated and the formatted value displayed on the UI.
  • When the validate method is called by app, all messages are cleared and full validation run using the display value. See validate method on the sub-classes for details. Note: JET validation is designed to catch user input errors, and not invalid data passed from the server; this should be caught on the server.
  • When certain properties change through programmatic intervention by app, the component determines whether it needs to run normal validation based on the state the component is in. Refer to the Mixed Validation section below for details.

Deferred Validation

Deferred validation is run in the following cases on the component value using the implicit required validator if required is true, and validation errors are deferred, i.e., not shown to user immediately. Refer to the Showing Deferred Messages section to understand how deferred messages can be shown.
  • When a component is created and it is required deferred validation is run and no messages are cleared prior to running validation. Refer to the Validators Participating in Deferred Validation section for details.
  • When the value property changes due to programmatic intervention deferred validation is run, after all messages and messagesCustom property are cleared.
  • When the reset method is called, deferred validation is run after all messages and messagesCustom property are cleared.
  • When certain properties change through programmatic intervention by app, the component determines whether it needs to run deferred validation based on the state the component is in. Refer to the Mixed Validation section below for details.

Mixed Validation

Either deferred or normal validation is run in the following cases based on the state the component is in and any validation errors encountered are either hidden or shown to user.
  • when disabled property changes. See disabled property for details.
  • when refresh method is called. See refresh method for details.
  • when converter property changes. Not all EditableValue components have the converter property. See the sub-classes that have the converter property for details, e.g., oj.inputBase#converter.
  • when required property changes. Not all EditableValue components have the required property. See the sub-classes that have the required property for details, e.g., oj.inputBase#required.
  • when validators property changes. Not all EditableValue components have the validators property. See the sub-classes that have the validators property for details, e.g., oj.inputBase#validators.
  • when asyncValidators property changes. Not all EditableValue components have the asyncValidators property. See the sub-classes that have the asyncValidators property for details, e.g., oj.inputBase#async-validators.

Showing Deferred Messages

Deferred validation messages are displayed only when page author requests for it explicitly in one of the following ways:

Validators Participating in Deferred Validation

The required validator is the only validator type that participates in deferred validation. The required property needs to be set to true for the required validator to run.

Touch End User Information

Target Gesture Action
Input Field Tap If the drop down is not open, expand the drop down list. Otherwise, close the drop down list. If hints, title or messages exist in a notewindow, pop up the notewindow.
Arrow Button Tap If the drop down is not open, expand the drop down list. Otherwise, close the drop down list.
Option Item Tap Tap on an option item in the drop down list to select.

Disabled option items receive no highlight and are not selectable.

Keyboard End User Information

Target Key Action
Option item Enter Select the highlighted choice from the drop down.
Input field Enter Set the input text as the value.
Drop down 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.
Drop down Esc Collapse the drop down list. If the drop down is already closed, do nothing.
Combobox Tab In Set focus to the combobox. If hints, title or messages exist in a notewindow, pop up the notewindow.

Disabled option items receive no highlight and are not selectable.

Performance

Page Load

If the options attribute is a data provider, and if there is an initially selected value, setting the valueOption attribute initially can improve page load performance because the element will not have to fetch the selected label from the data provider.

When using a data provider, the dropdown data isn't fetched until the user opens the dropdown.

Styling

The following CSS classes can be applied by the page author as needed.

The form control style classes can be applied to the component, or an ancestor element. When applied to an ancestor element, all form components that support the style classes will be affected.

Class Description
oj-form-control-full-width Changes the max-width to 100% so that form components will occupy all the available horizontal space
oj-form-control-text-align-right Aligns the text to the right regardless of the reading direction. This is normally used for right aligning numbers
oj-form-control-text-align-start Aligns the text to the left in ltr and to the right in rtl
oj-form-control-text-align-end Aligns the text to the right in ltr and to the left in rtl

Reading direction

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

Accessibility

It is up to the application developer to associate an oj-label to the combobox element. You should put an id on the combobox element, and then set the for attribute on the oj-label to be the combobox element's id.

The element will decorate its associated label with required and help information, if the required and help attributes are set.

Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.

Slots

JET components that allow child content support slots. Please see the slots section of the JET component overview doc for more information on allowed slot content and slot types.

Default

The <oj-combobox-one> element accepts oj-option elements as children. See the oj-option documentation for details about accepted children and slots.

contextMenu

The contextMenu slot is set on the oj-menu within this element. This is used to designate the JET Menu that this component should launch as a context menu on right-click, Shift-F10, Press & Hold, or component-specific gesture. If specified, the browser's native context menu will be replaced by the JET Menu specified in this slot.

The application can register a listener for the Menu's ojBeforeOpen event. The listener can cancel the launch via event.preventDefault(), or it can customize the menu contents by editing the menu DOM directly, and then calling refresh() on the Menu.

To help determine whether it's appropriate to cancel the launch or customize the menu, the ojBeforeOpen listener can use component API's to determine which table cell, chart item, etc., is the target of the context menu. See the JSDoc of the individual components for details.

Keep in mind that any such logic must work whether the context menu was launched via right-click, Shift-F10, Press & Hold, or component-specific touch gesture.

end

PREVIEW: This is a preview API. Preview APIs are production quality, but can be changed on a major version without a deprecation path.

The end slot is for replacing combobox one's drop down arrow and the divider. For example, a magnifying glass icon for a search field can be provided in this slot. When the slot is provided with empty content, nothing will be rendered in the slot. When the slot is not provided, the default drop down arrow icon and the divider will be rendered.

Since:
  • 4.2.0

Attributes

async-validators :Array.<oj.AsyncValidator.<V>>

List of asynchronous validators used by the component when performing validation. Use async-validators when you need to perform some validation work on the server. Otherwise, use validators, which are synchronous.

Each item in the Array is an instance that duck types oj.AsyncValidator. Implicit validators created by a component when certain attributes are present (e.g. required attribute) are separate from validators specified through the async-validators attribute and the validators attribute. At runtime when the component runs validation, it combines the implicit validators with the list specified through the validators attribute and also the list specified through the async-validators attribute. Error messages are shown as soon as each async validator returns; we do not wait until all the async validators finish to show errors. If the component's valid state changes for the worse, it is also updated as each validator returns so valid will be invalidShown as soon as the first validator has an Error.

It is recommended that you show the value you are validating in the error message because if the async operation takes a while, the user could be typing in a new value when the error message comes back and might be confused what value the error is for. However, if the user enters a new value (like presses Enter or Tab), a new validation lifecycle will start and validation errors for the previous value will not be shown to the user. If you need to format the value for the error message, you can use oj.IntlConverterUtils.getConverterInstance(converterOption) to get the converter instance, then call converter.format(value).

Hints exposed by async-validators and validators are shown in the notewindow by default, or as determined by the 'validatorHint' property set on the display-options attribute.

Since async validators are run asynchronously, you should wait on the BusyContext before you check valid property or the value property. Alternatively you can add a callback to the validChanged or valueChanged events.

The steps performed always, running validation and clearing messages is the same as for the validators attribute.


Default Value:
  • []
Names
Item Name
Property asyncValidators
Property change event asyncValidatorsChanged
Property change listener attribute (must be of type function) on-async-validators-changed

converter :(Promise.<oj.Converter.<V>>|oj.Converter.<V>|oj.Validation.RegisteredConverter|null)

A converter instance or Promise to a converter instance that duck types oj.Converter. Or an object literal containing the following properties.

When converter property changes due to programmatic intervention, the element performs various tasks based on the current state it is in.

Steps Performed Always

  • Any cached converter instance is cleared and new converter created. The converter hint is pushed to messaging. E.g., notewindow displays the new hint(s).

Running Validation

  • if element is valid when converter property changes, the display value is refreshed.
  • if element is invalid and is showing messages when converter property changes, then all messages generated by the element are cleared and full validation run using its current display value.
    • if there are validation errors, then value property is not updated, and the errors are shown. The display value is not refreshed in this case.
    • if no errors result from the validation, value property is updated; page author can listen to the valueChanged event on the value property to clear custom errors. The display value is refreshed with the formatted value provided by converter.
  • if element is invalid and has deferred messages when converter property changes, then the display value is refreshed with the formatted value provided by converter.

Clearing Messages

  • When element messages are cleared in the cases described above, messages created by the element are cleared.
  • messages-custom property is not cleared. Page authors can choose to clear it explicitly when setting the converter property.

Properties:
Name Type Argument Description
type 'number' | 'datetime' the converter type registered with the oj.ConverterFactory. Supported types are 'number' and 'datetime'. See oj.ConverterFactory for details.
E.g., {converter: {type: 'number'}
options Object <optional>
optional Object literal of options that the converter expects. See oj.IntlNumberConverter for options supported by the number converter. E.g., {converter: {type: 'number', options: {style: 'decimal'}}
Default Value:
  • null
Names
Item Name
Property converter
Property change event converterChanged
Property change listener attribute (must be of type function) on-converter-changed

(nullable) described-by :string

It is used to establish a relationship between this component and another element. Typically this is not used by the application developer, but by the oj-label custom element's code. One use case is where the oj-label custom element code writes described-by on its form component for accessibility reasons. To facilitate correct screen reader behavior, the described-by attribute is copied to the aria-describedby attribute on the component's dom element.
Since:
  • 4.0.0
Names
Item Name
Property describedBy
Property change event describedByChanged
Property change listener attribute (must be of type function) on-described-by-changed

disabled :boolean

Whether the component is disabled. The default is false.

When the disabled property changes due to programmatic intervention, the component may clear messages and run validation in some cases.

  • when a required component is initialized as disabled value="{{currentValue}}" required disabled, deferred validation is skipped.
  • when a disabled component is enabled,
    • if component is invalid and showing messages then all component messages are cleared, and full validation run using the display value.
      • if there are validation errors, they are shown.
      • if no errors result from the validation, the value property is updated. Page authors can listen to the valueChanged event to clear custom errors.
    • if component is valid and has no errors then deferred validation is run.
      • if there is a deferred validation error, then the valid property is updated.
    • if component is invalid and deferred errors then component messages are cleared and deferred validation re-run.
      • if there is a deferred validation error, then the valid property is updated.
  • when enabled component is disabled then no validation is run and the component appears disabled.

Default Value:
  • false
Since:
  • 0.7.0
Names
Item Name
Property disabled
Property change event disabledChanged
Property change listener attribute (must be of type function) on-disabled-changed

display-options :Object

Display options for auxilliary content that determines where it should be displayed in relation to the component.

The types of messaging content for which display options can be configured include converterHint, helpInstruction, messages, and validatorHint.
The display options for each type is specified either as an array of strings or a string. When an array is specified the first display option takes precedence over the second and so on.

When display-options changes due to programmatic intervention, the component updates its display to reflect the updated choices. For example, if 'help.instruction' property goes from 'notewindow' to 'none' then it no longer shows in the notewindow.

A side note: help.instruction and message detail text can include formatted HTML text, whereas hints and message summary text cannot. If you use formatted text, it should be accessible and make sense to the user if formatting wasn't there. To format the help.instruction, you could do this:

<html>Enter <b>at least</b> 6 characters</html>

Since:
  • 0.7
Names
Item Name
Property displayOptions
Property change event displayOptionsChanged
Property change listener attribute (must be of type function) on-display-options-changed

display-options.converter-hint :Array<'placeholder'|'notewindow'|'none'>|'placeholder'|'notewindow'|'none'

Display options for auxilliary converter hint text that determines where it should be displayed in relation to the component. When there is already a placeholder set on the component, the converter hint falls back to display type of 'notewindow'.
Default Value:
  • ['placeholder','notewindow']
Since:
  • 0.7
Names
Item Name
Property displayOptions.converterHint

display-options.help-instruction :Array<'notewindow'|'none'>|'notewindow'|'none'

Display options for auxilliary help instruction text that determines where it should be displayed in relation to the component.
Default Value:
  • ['notewindow']
Since:
  • 0.7
Names
Item Name
Property displayOptions.helpInstruction

display-options.messages :Array<'inline'|'notewindow'|'none'>|'inline'|'notewindow'|'none'

Display options for auxilliary message text that determines where it should be displayed in relation to the component.
Default Value:
  • ['inline']
Since:
  • 0.7
Names
Item Name
Property displayOptions.messages

display-options.validator-hint :Array<'notewindow'|'none'>|'notewindow'|'none'

Display options for auxilliary validator hint text that determines where it should be displayed in relation to the component.
Default Value:
  • ['notewindow']
Since:
  • 0.7
Names
Item Name
Property displayOptions.validatorHint

filter-on-open :"none"|"rawValue"

PREVIEW: This is a preview API. Preview APIs are production quality, but can be changed on a major version without a deprecation path.

Whether to filter the list with the current display value on opening the drop down. This can be used to support search use cases. This only applies to the initial opening of the drop down. When the user starts typing, the dropdown filters as usual.
Supported Values:
Value Description
"none" Show all available options without filtering on open.
"rawValue" Filter the drop down list on open with the rawValue (current display value).
Default Value:
  • "none"
Since:
  • 4.2.0
Names
Item Name
Property filterOnOpen
Property change event filterOnOpenChanged
Property change listener attribute (must be of type function) on-filter-on-open-changed

help :Object

Form component help information.
Since:
  • 0.7.0
Names
Item Name
Property help
Property change event helpChanged
Property change listener attribute (must be of type function) on-help-changed

help.instruction :string

Represents advisory information for the component, such as would be appropriate for a tooltip.

When help.instruction is present it is by default displayed in the notewindow, or as determined by the 'helpInstruction' property set on the displayOptions attribute. When the help.instruction property changes the component refreshes to display the updated information.

JET takes the help instruction text and creates a notewindow with the text. The notewindow pops up when the field takes focus and closes when the field loses focus.

How is help.instruction better than the html 'title' attribute? The html 'title' attribute only shows up as a tooltip on mouse over, not on keyboard and not in a mobile device. So the html 'title' would only be for text that is not important enough to show all users, or for text that you show the users in another way as well, like in the label. Also you cannot theme the native browser's title window like you can the JET notewindow, so low vision users may have a hard time seeing the 'title' window. For these reasons, the JET EditableValue components do not use the HTML's 'title' attribute and instead use the help.instruction attribute.

To include formatted text in the help.instruction, format the string using html tags. For example the help.instruction might look like:

<oj-some-element help.instruction="<html>Enter <b>at least</b> 6 characters</html>"></oj-some-element>
If you use formatted text, it should be accessible and make sense to the user if formatting wasn't there.

Default Value:
  • ""
Since:
  • 4.0.0
Names
Item Name
Property help.instruction

help-hints :Object

Represents hints for oj-form-layout element to render help information on the label of the editable component.

This is used only if the editable component is added as a direct child to an oj-form-layout element, and the labelHint property is also specified.

The helpHints object contains a definition property and a source property.

  • definition - hint for help definition text.
  • source - hint for help source URL.
Since:
  • 4.1.0
Names
Item Name
Property helpHints
Property change event helpHintsChanged
Property change listener attribute (must be of type function) on-help-hints-changed

(nullable) help-hints.definition :string

Hint for help definition text associated with the label.

It is what shows up when the user hovers over the help icon, or tabs into the help icon, or press and holds the help icon on a mobile device. No formatted text is available for help definition attribute.

See the help-hints attribute for usage examples.

Default Value:
  • ""
Since:
  • 4.1.0
Names
Item Name
Property helpHints.definition

(nullable) help-hints.source :string

Hint for help source URL associated with the label.

If present, a help icon will render next to the label. For security reasons we only support urls with protocol http: or https:. If the url doesn't comply we ignore it and throw an error. Pass in an encoded URL since we do not encode the URL.

See the help-hints attribute for usage examples.

Default Value:
  • ""
Since:
  • 4.1.0
Names
Item Name
Property helpHints.source

label-hint :string

Represents a hint for oj-form-layout element to render a label on the editable component.

This is used only if the editable component is added as a direct child to an oj-form-layout element.

When labelHint is present it gives a hint to the oj-form-layout element to create an oj-label element for the editable component. When the labelHint property changes oj-form-layout element refreshes to display the updated label information.

Default Value:
  • ""
Since:
  • 4.1.0
Names
Item Name
Property labelHint
Property change event labelHintChanged
Property change listener attribute (must be of type function) on-label-hint-changed

labelled-by :string|null

The oj-label sets the labelledBy property programmatically on the form component to make it easy for the form component to find its oj-label component (a document.getElementById call.)

The application developer should use the 'for'/'id api to link the oj-label with the form component; the 'for' on the oj-label to point to the 'id' on the input form component. This is the most performant way for the oj-label to find its form component.

// setter myComp.labelledBy = "labelId";
Default Value:
  • null
Since:
  • 7.0.0
Names
Item Name
Property labelledBy
Property change event labelledByChanged
Property change listener attribute (must be of type function) on-labelled-by-changed

messages-custom :Array.<oj.Message>

List of messages an app would add to the component when it has business/custom validation errors that it wants the component to show. This allows the app to perform further validation before sending data to the server. When this option is set the message shows to the user right away. To clear the custom message, set messagesCustom back to an empty array.

Each message in the array is an object that duck types oj.Message. See oj.Message for details.

See the Validation and Messages section for details on when the component clears messagesCustom; for example, when full validation is run.

Default Value:
  • []
Supports writeback:
  • true
Since:
  • 0.7.0
Names
Item Name
Property messagesCustom
Property change event messagesCustomChanged
Property change listener attribute (must be of type function) on-messages-custom-changed

min-length :number

The minimum number of characters a user must type before a options filtering is performed. Zero is useful for local data with just a few items, but a higher value should be used when a single character search could match a few thousand items.
Default Value:
  • 0
Names
Item Name
Property minLength
Property change event minLengthChanged
Property change listener attribute (must be of type function) on-min-length-changed

(nullable) option-renderer :((param0: ojCombobox.OptionContext) => Element)|null

The renderer function that renders the content of each option. The function should return an oj-option element (for leaf option) or an oj-optgroup element (for group option).

It is not necessary to set the "value" attribute on the oj-option as it is available from the options data.

Note: Prior to version 6.1.0, the function could also return one of the following:

  • An Object with the following property:
    • insert: HTMLElement - A DOM element representing the content of the option.
  • undefined: If the developer chooses to manipulate the option content directly, the function should return undefined.
This is deprecated and support may be removed in the future.

The option-renderer decides only how the options' content has to be rendered in the drop down. Once an option is selected from the drop down, what value has to be displayed in the in input field is decided by the label field in the data object. See options and options-keys for configuring option label and value.

The context parameter passed to the renderer contains the following keys:

Key Description
componentElement A reference to the Combobox element.
parent The parent of the data item. The parent is null for root node.
index The index of the option, where 0 is the index of the first option. In the hierarchical case the index is relative to its parent.
depth The depth of the option. The depth of the first level children under the invisible root is 0.
leaf Whether the option is a leaf or a group.
data The data object for the option.
parentElement The option label element. The renderer can use this to directly append content.
Default Value:
  • null
Names
Item Name
Property optionRenderer
Property change event optionRendererChanged
Property change listener attribute (must be of type function) on-option-renderer-changed

options :(Array.<(oj.ojCombobox.Option|oj.ojCombobox.Optgroup)>|oj.DataProvider.<K, D>|null)

The option items for the Combobox. This attribute can be used instead of providing a list of oj-option or oj-optgroup child elements of the Combobox element. This attribute accepts:
  1. an array of oj.ojCombobox.Option and/or oj.ojCombobox.Optgroup.
    • Use oj.ojCombobox.Option for a leaf option.
    • Use oj.ojCombobox.Optgroup for a group option.
  2. a data provider. This data provider must implement oj.DataProvider.
    • value in oj.ojCombobox.Option must be the row key in the data provider.
    • A maximum of 15 rows will be displayed in the dropdown. If more than 15 results are available then users need to filter further.
    • If the data provider supports the filter criteria capability including the contains ($co or $regex) operator, JET Combobox will request the data provider to do filtering. Otherwise it will filter internally.
    • See also Improve page load performance
Default Value:
  • null
Names
Item Name
Property options
Property change event optionsChanged
Property change listener attribute (must be of type function) on-options-changed

(nullable) options-keys :(oj.ojCombobox.OptionsKeys|null)

Specify the key names to use in the options array.

Depending on options-keys means that the signature of the data does not match what is supported by the options attribute. When using Typescript, this would result in a compilation error.

Best practice is to use a oj.ListDataProviderView with data mapping as a replacement.

However, for the app that must fetch data from a REST endpoint where the data fields do not match those that are supported by the options attribute, you may use the options-keys with any dataProvider that implements oj.DataProvider interface.

Note: child-keys and children properties in options-keys are ignored when using a oj.TreeDataProvider.

Default Value:
  • null
Names
Item Name
Property optionsKeys
Property change event optionsKeysChanged
Property change listener attribute (must be of type function) on-options-keys-changed

(nullable) options-keys.child-keys :oj.ojCombobox.OptionsKeys

The object for the child keys. It is ignored when using a oj.TreeDataProvider.
Properties:
Name Type Argument Description
label string <optional>
<nullable>
The key name for the label.
value string <optional>
<nullable>
The key name for the value.
children string <optional>
<nullable>
The key name for the children.
childKeys oj.ojCombobox.OptionsKeys | null <optional>
<nullable>
The object for the child keys.
Default Value:
  • null
Names
Item Name
Property optionsKeys.childKeys

(nullable) options-keys.children :string

The key name for the children. It is ignored when using a oj.TreeDataProvider.
Default Value:
  • null
Names
Item Name
Property optionsKeys.children

(nullable) options-keys.label :string

The key name for the label.
Default Value:
  • null
Names
Item Name
Property optionsKeys.label

(nullable) options-keys.value :string

The key name for the value.
Default Value:
  • null
Names
Item Name
Property optionsKeys.value

(nullable) picker-attributes :Object

Attributes specified here will be set on the picker DOM element when it's launched.

The supported attributes are class and style, which are appended to the picker's class and style, if any. Note: 1) picker-attributes is not applied in the native theme. 2) setting this attribute after element creation has no effect.

Properties:
Name Type Argument Description
style string <optional>
The css style to append to the picker.
class string <optional>
The css class to append to the picker.
Default Value:
  • null
Names
Item Name
Property pickerAttributes
Property change event pickerAttributesChanged
Property change listener attribute (must be of type function) on-picker-attributes-changed

placeholder :string|null

The placeholder text to set on the element. The placeholder specifies a short hint that can be displayed before user selects or enters a value.
Default Value:
  • null
Names
Item Name
Property placeholder
Property change event placeholderChanged
Property change listener attribute (must be of type function) on-placeholder-changed

(readonly, nullable) raw-value :string

The rawValue is the read-only property for retrieving the current value from the input field in string form. The main consumer of rawValue is a converter.

The rawValue updates on the 'input' javascript event, so the rawValue changes as the value of the input is changed. If the user types in '1,200' into the field, the rawValue will be '1', then '1,', then '1,2', ..., and finally '1,200'. Then when the user blurs or presses Enter the value property gets converted and validated (if there is a converter or validators) and then gets updated if valid.

This is a read-only attribute so page authors cannot set or change it directly.

Default Value:
  • null
Supports writeback:
  • true
Since:
  • 1.2.1
Names
Item Name
Property rawValue
Property change event rawValueChanged
Property change listener attribute (must be of type function) on-raw-value-changed

readonly :boolean

Dictates element's readonly state.
Default Value:
  • false
Names
Item Name
Property readonly
Property change event readonlyChanged
Property change listener attribute (must be of type function) on-readonly-changed

required :boolean

Whether the Combobox is required or optional. When required is set to true, an implicit required validator is created using the validator factory - oj.Validation.validatorFactory(oj.ValidatorFactory.VALIDATOR_TYPE_REQUIRED).createValidator(). Translations specified using the translations.required attribute and the label associated with the Combobox, are passed through to the options parameter of the createValidator method.

When required property changes due to programmatic intervention, the Combobox may clear messages and run validation, based on the current state it's in.

Running Validation

  • if element is valid when required is set to true, then it runs deferred validation on the value. This is to ensure errors are not flagged unnecessarily.
  • if element is invalid and has deferred messages when required is set to false, then element messages are cleared but no deferred validation is run.
  • if element is invalid and currently showing invalid messages when required is set, then element messages are cleared and normal validation is run using the current display value.
    • if there are validation errors, then value property is not updated and the error is shown.
    • if no errors result from the validation, the value property is updated; page author can listen to the valueChanged event on the value property to clear custom errors.

Clearing Messages

  • Only messages created by the element are cleared.
  • messages-custom attribute is not cleared.

This property set to false implies that a value is not required to be provided by the user. This is the default. This property set to true implies that a value is required to be provided by user and the input's label will render a required icon. Additionally a required validator - oj.RequiredValidator - is implicitly used if no explicit required validator is set. An explicit required validator can be set by page authors using the validators attribute.
Default Value:
  • false
Since:
  • 0.7.0
See:
Names
Item Name
Property required
Property change event requiredChanged
Property change listener attribute (must be of type function) on-required-changed

translations :object|null

A collection of translated resources from the translation bundle, or null if this component has no resources. Resources may be accessed and overridden individually or collectively, as seen in the examples.

If the component does not contain any translatable resource, the default value of this attribute will be null. If not, an object containing all resources relevant to the component.

If this component has translations, their documentation immediately follows this doc entry.

Names
Item Name
Property translations
Property change event translationsChanged
Property change listener attribute (must be of type function) on-translations-changed

translations.filter-further :string

Text at the top of drop down when not all results are fetched and users need to filter further.

Default Value:
  • "More results available, please filter further."
Names
Item Name
Property translations.filterFurther

translations.more-matches-found :string

Text for the drop down when more than one options are found.

Default Value:
  • "num matches found"
Names
Item Name
Property translations.moreMatchesFound

translations.no-matches-found :string

No options found text for drop down.

Default Value:
  • "No matches found"
Names
Item Name
Property translations.noMatchesFound

translations.one-matches-found :string

Text for the drop down when one option is found.

Default Value:
  • "One match found"
Names
Item Name
Property translations.oneMatchesFound

(nullable) translations.required :Object

Provides properties to customize the summary, detail and hint text used by the implicit required validator associated to any editable component that supports the required option.

See the translations attribute and required option for usage examples.

Since:
  • 0.7
Names
Item Name
Property translations.required

(nullable) translations.required.hint :string

Hint text used by required validation error.

See the translations attribute for usage examples.

Default Value:
  • ""
Since:
  • 0.7
See:
Names
Item Name
Property translations.required.hint

(nullable) translations.required.message-detail :string

Message text that describes the details of the required validation error.

See the translations attribute for usage examples.

Default Value:
  • ""
Since:
  • 0.7
See:
Names
Item Name
Property translations.required.messageDetail

(nullable) translations.required.message-summary :string

Message text for summarizing a required validation error.

See the translations attribute for usage examples.

Default Value:
  • ""
Since:
  • 0.7
See:
Names
Item Name
Property translations.required.messageSummary

(readonly) valid :"valid"|"pending"|"invalidHidden"|"invalidShown"

PREVIEW: This is a preview API. Preview APIs are production quality, but can be changed on a major version without a deprecation path.

The current valid state of the component. It is evaluated on initial render. It is re-evaluated

  • after each validator (validators or async-validators) is run (full or deferred)
  • when messagesCustom is updated, since messagesCustom can be added by the app developer any time.
  • when showMessages() is called. Since showMessages() moves the hidden messages into messages shown, if the valid state was "invalidHidden" then it would become "invalidShown".
  • when the required property has changed. If a component is empty and has required set, the valid state may be "invalidHidden" (if no invalid messages are being shown as well). If required property is removed, the valid state would change to "valid".

Note: New valid states may be added to the list of valid values in future releases. Any new values will start with "invalid" if it is an invalid state, "pending" if it is pending state, and "valid" if it is a valid state.

Supported Values:
Value Description
"invalidHidden" The component has invalid messages hidden and no invalid messages showing. An invalid message is one with severity "error" or higher.
"invalidShown" The component has invalid messages showing. An invalid message is one with severity "error" or higher.
"pending" The component is waiting for the validation state to be determined. The "pending" state is set at the start of the convert/validate process.
"valid" The component is valid
Supports writeback:
  • true
Since:
  • 4.2.0
Names
Item Name
Property valid
Property change event validChanged
Property change listener attribute (must be of type function) on-valid-changed

validators :(Array.<(oj.Validator.<V>|oj.Validation.RegisteredValidator)>|null)

List of synchronous validators used by component along with asynchronous validators and the implicit component validators when performing validation. Each item is either an instance that duck types oj.Validator, or is an Object literal containing the properties listed below.

Implicit validators are created by the element when certain attributes are present. For example, if the required attribute is set, an implicit oj.RequiredValidator is created. At runtime when the component runs validation, it combines all the implicit validators with all the validators specified through this validators attribute and the async-validators attribute, and runs all of them.

Hints exposed by validators are shown in the notewindow by default, or as determined by the 'validatorHint' property set on the display-options attribute.

When validators property changes due to programmatic intervention, the element may decide to clear messages and run validation, based on the current state it is in.

Steps Performed Always

  • The cached list of validator instances are cleared and new validator hints is pushed to messaging. E.g., notewindow displays the new hint(s).

Running Validation

  • if element is valid when validators changes, element does nothing other than the steps it always performs.
  • if element is invalid and is showing messages - messages-shown property is non-empty, when validators or async-validators
  • if there are validation errors, then value property is not updated and the error is shown.
  • if no errors result from the validation, the value property is updated; page author can listen to the valueChanged event on the value property to clear custom errors.
  • if element is invalid and has deferred messages when validators changes, it does nothing other than the steps it performs always.
  • Clearing Messages

    • Only messages created by the element are cleared.
    • messages-custom property is not cleared.

    Properties:
    Name Type Argument Description
    type string the validator type that has a oj.ValidatorFactory that can be retrieved using the oj.Validation module. For a list of supported validators refer to oj.ValidatorFactory.
    E.g., {validators: [{type: 'regExp'}]}
    options Object <optional>
    optional Object literal of options that the validator expects.
    E.g., {validators: [{type: 'regExp', options: {pattern: '[a-zA-Z0-9]{3,}'}}]}
    Default Value:
    • []
    Names
    Item Name
    Property validators
    Property change event validatorsChanged
    Property change listener attribute (must be of type function) on-validators-changed

    value :(V|null)

    The value of the element. It supports any type.
    Default Value:
    • null
    Supports writeback:
    • true
    Names
    Item Name
    Property value
    Property change event valueChanged
    Property change listener attribute (must be of type function) on-value-changed

    value-option :null|Object

    The valueOption is similar to the value, but is an Object which contains both a value and display label. The value and valueOption are kept in sync. If initially both are set, the selected value in the value attribute has precedence.

    Note: If the options attribute is a data provider, and if there is an initially selected value, setting the valueOption attribute initially can improve page load performance because the element will not have to fetch the selected label from the data provider.

    If valueOption is not specified or the selected value is missing, then the label will be fetched from the data provider.

    Properties:
    Name Type Argument Description
    value V | null current value of JET Combobox
    label string <optional>
    display label of value above. If missing, String(value) is used.
    Default Value:
    • null
    Supports writeback:
    • true
    Names
    Item Name
    Property valueOption
    Property change event valueOptionChanged
    Property change listener attribute (must be of type function) on-value-option-changed

    Events

    ojAnimateEnd

    Triggered when a default animation has ended.
    Properties:

    All of the event payloads listed below can be found under event.detail.

    Name Type Description
    action string The action that triggers the animation. Supported values are:
    • "inline-open" - when an inline message container opens or increases in size
    • "inline-close" - when an inline message container closes or decreases in size
    • "notewindow-open" - when a note window opens
    • "notewindow-close" - when a note window closes
    element Element The element being animated.
    Since:
    • 4.0.0

    ojAnimateStart

    Triggered when a default animation is about to start on an element owned by the component.

    The default animation can be cancelled by calling event.preventDefault, followed by a call to event.detail.endCallback. event.detail.endCallback should be called immediately after event.preventDefault if the application merely wants to cancel animation, or it should be called when the custom animation ends if the application is invoking another animation function. Failure to call event.detail.endCallback may prevent the component from working properly.

    For more information on customizing animations, see the documentation of oj.AnimationUtils.

    The default animations are controlled via the theme (SCSS) :
    
    // default animations for "notewindow" display option
    $popupTailOpenAnimation: (effect: "zoomIn", transformOrigin: "#myPosition") !default;
    $popupTailCloseAnimation: (effect: "none") !default;
    
    // default animations for "inline" display option
    $messageComponentInlineOpenAnimation: (effect: "expand", startMaxHeight: "#oldHeight") !default;
    $messageComponentInlineCloseAnimation: (effect: "collapse", endMaxHeight: "#newHeight") !default;
    
    Properties:

    All of the event payloads listed below can be found under event.detail.

    Name Type Description
    action string The action that triggers the animation. Supported values are:
    • "inline-open" - when an inline message container opens or increases in size
    • "inline-close" - when an inline message container closes or decreases in size
    • "notewindow-open" - when a note window opens
    • "notewindow-close" - when a note window closes
    element Element The element being animated.
    endCallback function():void If the event listener calls event.preventDefault to cancel the default animation, it must call the endCallback function when it finishes its own animation handling and any custom animation has ended.
    Since:
    • 4.0.0

    ojValueUpdated

    PREVIEW: This is a preview API. Preview APIs are production quality, but can be changed on a major version without a deprecation path.

    Triggered when the value is submitted by the user through pressing the enter key or selecting from the drop down list. This is to support search use cases. The event will be fired even if the value is the same. This will help the application to re-submit the search query for the same value. The event is not triggered if the submitted value fails validation. The event is not triggered on blur or tab out.
    Properties:

    All of the event payloads listed below can be found under event.detail.

    Name Type Description
    value any the current value
    previousValue any the previous value
    Since:
    • 4.2.0

    Methods

    getProperty(property) → {any}

    Retrieves the value of a property or a subproperty. The return type will be the same as the type of the property as specified in this API document. If the method is invoked with an incorrect property/subproperty name, it returns undefined.
    Parameters:
    Name Type Description
    property string The property name to get. Supports dot notation for subproperty access.
    Since:
    • 4.0.0
    Returns:
    Type
    any
    Example

    Get a single subproperty of a complex property:

    let subpropValue = myComponent.getProperty('complexProperty.subProperty1.subProperty2');

    refresh() → {void}

    Refreshes the combobox.

    This method does not accept any arguments.

    Returns:
    Type
    void

    reset() → {void}

    Resets the component by clearing all messages and messages attributes - messagesCustom - and updates the component's display value using the attribute value. User entered values will be erased when this method is called.
    Since:
    • 0.7.0
    Returns:
    Type
    void

    setProperties(properties) → {void}

    Performs a batch set of properties. The type of value for each property being set must match the type of the property as specified in this API document.
    Parameters:
    Name Type Description
    properties Object An object containing the property and value pairs to set.
    Since:
    • 4.0.0
    Returns:
    Type
    void
    Example

    Set a batch of properties:

    myComponent.setProperties({"prop1": "value1", "prop2.subprop": "value2", "prop3": "value3"});

    setProperty(property, value) → {void}

    Sets a property or a subproperty (of a complex property) and notifies the component of the change, triggering a [property]Changed event. The value should be of the same type as the type of the attribute mentioned in this API document.
    Parameters:
    Name Type Description
    property string The property name to set. Supports dot notation for subproperty access.
    value any The new value to set the property to.
    Since:
    • 4.0.0
    Returns:
    Type
    void
    Example

    Set a single subproperty of a complex property:

    myComponent.setProperty('complexProperty.subProperty1.subProperty2', "someValue");

    showMessages() → {void}

    Takes all deferred messages and shows them. It then updates the valid property; e.g., if the valid state was "invalidHidden" before showMessages(), the valid state will become "invalidShown" after showMessages().

    If there were no deferred messages this method simply returns.

    Since:
    • 0.7.0
    Returns:
    Type
    void

    validate() → {Promise}

    PREVIEW: This is a preview API. Preview APIs are production quality, but can be changed on a major version without a deprecation path.

    1. All messages are cleared, including custom messages added by the app.
    2. If no converter is present then processing continues to next step. If a converter is present, the UI value is first converted (i.e., parsed). If there is a parse error then the messages are shown.
    3. If there are no validators setup for the component the value option is updated using the display value. Otherwise all validators are run in sequence using the parsed value from the previous step. The implicit required validator is run first if the component is marked required. When a validation error is encountered it is remembered and the next validator in the sequence is run.
    4. At the end of validation if there are errors, the messages are shown. If there were no errors, then the value option is updated.
    Returns:
    Promise resolves to "valid" if there were no converter parse errors and the component passed all validations. The Promise resolves to "invalid" if there were converter parse errors or if there were validation errors.
    Type
    Promise