Class: SlickComplete

SlickComplete(target, parametersopt)

SlickComplete Class used to handle the SlickComplete module

Constructor

new SlickComplete(target, parametersopt)

Creates an instance of SlickComplete and checks for invalid parameters
Parameters:
Name Type Attributes Description
target Element | String The input targeted by the SlickComplete module
parameters Object <optional>
Additional optional parameters
Properties
Name Type Attributes Default Description
icon Boolean <optional>
false Set to `true` to enable item icons
lang String <optional>
en Language to be used while displaying predictions
items Array.<Object> Items to complete from
Properties
Name Type Description
id String | Number Item unique identifier
name Object Set this Object's keys to the languages you want to support and their values to the corresponding translation
aliases Array.<String> Aliases to search through for a single item
icon String Item's icon URL
Source:

Members

value :String|Number

The currently selected item
Type:
  • String | Number
Source:

Methods

destroy()

Removes any SlickComplete mutation from the DOM
Source:

find(value) → {SlickCompleteItem}

Finds the matching item for the user's query
Parameters:
Name Type Description
value String String to search
Source:
Returns:
The matching item
Type
SlickCompleteItem

offPredict() → {SlickComplete}

Removes every callback previously added with SlickComplete#onPredict
Source:
Returns:
The current SlickComplete
Type
SlickComplete

offSelect() → {SlickComplete}

Removes every callback previously added with SlickComplete#onSelect
Source:
Returns:
The current SlickComplete
Type
SlickComplete

onPredict(callback) → {SlickComplete}

Adds a callback to be used when a precition is displayed
Parameters:
Name Type Description
callback onPredictCallback Function to call after a prediction
Source:
Returns:
The current SlickComplete
Type
SlickComplete

onSelect(callback) → {SlickComplete}

Adds a callback to be used when the user selects an item
Parameters:
Name Type Description
callback onSelectCallback Function to call after the user's selection
Source:
Returns:
The current SlickComplete
Type
SlickComplete

refresh() → {SlickComplete}

Refreshes the input's display
Source:
Returns:
The current SlickComplete
Type
SlickComplete

select(itemId) → {SlickComplete}

Manually select an item
Parameters:
Name Type Description
itemId Object The item to select
Source:
Returns:
The current SlickComplete
Type
SlickComplete

setItems(items) → {SlickComplete}

Set the items to search through
Parameters:
Name Type Description
items Array.<Object> Items to complete from
Properties
Name Type Description
id String | Number Item unique identifier
name Object Set this Object's keys to the languages you want to support and their values to the corresponding translation
aliases Array.<String> Aliases to search through for a single item
icon String Item's icon URL
Source:
Returns:
The current SlickComplete
Type
SlickComplete