AutoComplete(options)

new AutoComplete(options)

Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Default Description
usageStatistics Boolean <optional>
true

Let us know the hostname. If you don't want to send the hostname, please set to false.

Examples

CommonJS

var AutoComplete = require('tui-auto-complete');
var autoComplete = new AutoComplete({'config': 'Default'});

Global Namespace

var autoComplete = new tui.AutoComplete({"config" : "Default"});

Arguments of AutoComplete Constructor

SAMPLE FILE: AutoConfig.json

Members

watchInterval :number

Interval for check update input

Default Value:
  • 300

Methods

clearReadyValue()

clear ready value and set idle state

getValue() → {String}

Return string in input element.

Returns:
String

hideResultList()

Hide search result list area

isShowResultList() → {Boolean}

Whether show the result list area or not.

Returns:
Boolean

isUseAutoComplete() → {Boolean}

Get whether use auto complete or not

Returns:
Boolean
Example
autoComplete.isUseAutoComplete(); => true|false

request(keyword)

Request data at api server with keyword

Parameters:
Name Type Description
keyword String

The key word to send to Auto complete API

setCookieValue(isUse)

Set Cookie value with whether use auto complete or not

Parameters:
Name Type Description
isUse Boolean

Whether use auto complete or not

setParams(paramStr, index)

Set additional parameters at inputManager.

Parameters:
Name Type Description
paramStr string

String to be addition parameters.(saperator '&')

index string

The index for setting key value

setQueries(queries)

Save matched queries from server.

Parameters:
Name Type Description
queries Array

Result queries

setSearchApi(options)

Reset serachApi

Parameters:
Name Type Description
options Object

searchApi option

Example
autoComplete.setSearchApi({
     'st' : 111,
     'r_lt' : 111,
     'r_enc' : 'UTF-8',
     'q_enc' : 'UTF-8',
     'r_format' : 'json'
 });

setServerData(dataArr)

Request to draw result at resultManager with data from api server.

Parameters:
Name Type Description
dataArr Array

Data array from api server

setValue(keyword)

Set inputManager's value to show at search element

Parameters:
Name Type Description
keyword String

The string to show up at search element

showResultList()

Show search result list area

Events

change

Fired when the user's selected element in result list is changed

Parameters:
Name Type Description
data Object

Data for submit

Properties
Name Type Description
index string

Index of collection

action string

Form action

params string

Parameters

close

Fired when hide the result list