ch.Autocomplete
Description
Autocomplete Component shows a list of suggestions for a HTMLInputElement.
How-to
Parameters
-
el
- HTMLElement : A HTMLElement to create an instance of ch.Autocomplete. -
options
- Object : Options to customize an instance.-
loadingClass
- String : Default: "ch-autocomplete-loading". -
highlightedClass
- String : Default: "ch-autocomplete-highlighted". -
itemClass
- String : Default: "ch-autocomplete-item". -
addClass
- String : CSS class names that will be added to the container on the component initialization. Default: "ch-box-lite ch-autocomplete". -
keystrokesTime
- Number : Default: 150. -
html
- Boolean : Default: false. -
side
- String : The side option where the target element will be positioned. You must use: "left", "right", "top", "bottom" or "center". Default: "bottom". -
align
- String : The align options where the target element will be positioned. You must use: "left", "right", "top", "bottom" or "center". Default: "left". -
offsetX
- Number : The offsetX option specifies a distance to displace the target horitontally. -
offsetY
- Number : The offsetY option specifies a distance to displace the target vertically. -
positioned
- String : The positioned option specifies the type of positioning used. You must use: "absolute" or "fixed". Default: "absolute". -
wrapper
- Boolean | String : Wrap the reference element and place the container into it instead of body. When value is a string it will be applied as additional wrapper class. Default: false.
-
Extends
Properties
.Component#name
String
The name of a component.
.container
HTMLDivElement
The autocomplete container.
.trigger
HTMLElement
The autocomplete trigger.
.uid
Number
A unique id to identify the instance of a component.
Methods
.constructor()
Returns a reference to the constructor function.
.destroy()
Destroys an Autocomplete instance.
.hide() → {autocomplete}
Hides component's container.
.isShown() → {Boolean}
Returns a Boolean if the component's core behavior is shown. That means it will return 'true' if the component is on and it will return false otherwise.
.suggest() → {autocomplete}
Add suggestions to be shown.
.constructor()
Returns a reference to the constructor function.
.destroy()
Destroys an instance of Component and remove its data from asociated element.
.disable() → {component}
Disables an instance of Component.
.enable() → {component}
Enables an instance of Component.
.require() → {component}
Adds functionality or abilities from other classes.
Events
'destroy'
Emits when a component is destroyed.
'disable'
Emits when a component is disable.
'enable'
Emits when a component is enabled.
'hide'
Event emitted when the Autocomplete container is hidden.
'ready'
Event emitted when the component is ready to use.
'select'
Event emitted when a suggestion is selected.
'type'
Event emitted when the user is typing.