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.
-
suggestionItemTemplate
-
The
suggestionItemTemplateslot is used to specify the template for rendering each suggestion in the dropdown list. The slot must be a <template> element.When the template is executed for each suggestion, it will have access to the binding context containing the following properties:
- $current - an object that contains information for the current suggestion. (See the table below for a list of properties available on $current)
- alias - if the data-oj-as attribute was specified on the template, the value will be used to provide an application-named alias for $current.
If no
suggestionItemTemplateis specified, the component will render based on the value of thesuggestionItemTextproperty.- Since:
- 9.1.0
Properties of $current:
Name Type Description dataD The data for the current suggestion indexnumber The zero-based index of the current suggestion keyK The key of the current suggestion metadataoj.ItemMetadata<K> The metadata for the current suggestion searchTextstring The search text entered by the user
Attributes
-
placeholder :string
-
The placeholder text to set on the element. The placeholder specifies a short hint that can be displayed before the user selects or enters a value.
- Default Value:
''
Names
Item Name Property placeholderProperty change event placeholderChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-placeholder-changed -
(readonly) raw-value :null|string
-
The
rawValueis the read-only property for retrieving the current value from the input field in string form.The
rawValueupdates on the 'input' javascript event, so therawValuechanges 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 thevalueproperty gets updated.This is a read-only attribute so page authors cannot set or change it directly.
- Supports writeback:
true
Names
Item Name Property rawValueProperty change event rawValueChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-raw-value-changed -
suggestion-item-text :keyof D | ((itemContext: CommonTypes.ItemContext<K, D>) => string)
-
Specifies the text string to render for a suggestion. This attribute can be set to either:
- a string that specifies the name of a top level data field to render as text, or
- a callback function that takes a context object and returns the text string to display
By default, the component will attempt to render a 'label' data field as text.
This text will be rendered for the selected value of the component. It will also be rendered for each suggestion in the dropdown if no suggestionItemTemplate is provided. When rendered for the dropdown suggestions, default matching search term highlighting will still be applied.
- Default Value:
'label'
Names
Item Name Property suggestionItemTextProperty change event suggestionItemTextChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-suggestion-item-text-changed -
suggestions :null | oj.DataProvider<K, D>
-
The suggestions data for the InputSearch.
Note that the
suggestion-item-textattribute allows for customizing the rendering of each suggestion. If it is not specified, then the component will attempt to render as text the 'label' field in the suggestion by default.- Default Value:
null
Names
Item Name Property suggestionsProperty change event suggestionsChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-suggestions-changed -
value :null|string
-
The value of the element.
- Supports writeback:
true
Names
Item Name Property valueProperty change event valueChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-value-changed
Events
-
ojValueAction
-
Triggered when search text is submitted by the user, even if the text hasn't changed. Submission is triggered by the enter key, either to directly submit text or to select a highlighted value from the suggestions dropdown, or by selecting a value from the dropdown using a mouse or touch gesture. Note that the value property is guaranteed to be up-to-date at the time the ojValueAction event is dispatched.
Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information.Name Type Description valuenull | string The search text. itemContextnull | CommonTypes.ItemContext.<K, D> The data provider context for the search text, if available.
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 propertystring 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'); -
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 propertiesObject 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 propertystring The property name to set. Supports dot notation for subproperty access. valueany 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");
Type Definitions
-
SuggestionItemTemplateContext<K, D>
-
Properties:
Name Type Description dataD The data for the current suggestion indexnumber The zero-based index of the current suggestion keyK The key of the current suggestion metadataoj.ItemMetadata<K> The metadata for the current suggestion searchTextstring The search text entered by the user