Localities Widget Reference 2.0
Localities Javascript Widget Reference 2.0- Autocomplete class
- AutocompleteParameters object Specification
- AutocompleteResponse object Specification
- AutocompleteResponseItem object Specification
- ComponentRestrictions object Specification
- DetailsResponseItem object Specification
Autocomplete class 🔗
woosmap.localities.Autocomplete
Constructor | |
Autocomplete( |
|
Methods | |
addListener( |
Return Value: Event Adds an event listener to the widget Can be removed using removeListener() with the same arguments |
getAutocompleteSuggestions( |
Return Value: AutocompleteResponse Returns the latest search results |
getSelectedSuggestionDetails( |
Return Value: DetailsResponseItem Returns the latest user-selected locality among search results |
removeListener( |
Removes given event listener from the widget |
setComponentRestrictions( |
Sets the component restrictions |
setCustomDescription( |
Sets the custom description to query |
setOptions( |
Sets new config options |
setTypes( |
Sets the types to query |
AutocompleteParameters object Specification 🔗
Properties | |
minLength |
Type: Number
Number of characters before sending request to Localities API |
customDescription |
Type: String
This parameter allows to choose the description format for all or some of the suggestion types selected. The custom formats are described as follows :
|
components |
Type: ComponentRestrictions
restricts predictions to selected components |
types |
Type: String| The types queried (example ‘locality’, ‘postal_code’, ‘country’ ; omit param for ‘locality’ + ‘postal_code’) |
data |
Type: String
Defaults to ‘standard’, can be set to ‘advanced’ to retrieve postal codes outside western Europe |
extended |
Type: String
can be set to ‘postal_code’ to search localities by name or postal codes |
language |
Type: String
expected response language. Default is the country local or browser language |
firstTabIndex |
Type: Number
all tabindexes in Autocomplete will start from that tabindex. Defaults to 0. |
debounceTime |
Type: Number
prevents autocomplete requests from being sent unnecessarily often. Default is no debounce. |
AutocompleteResponse object Specification 🔗
Properties | |
localities |
Type: AutocompleteResponseItem
Array with Autocomplete items |
AutocompleteResponseItem object Specification 🔗
Properties | |
public_id |
Type: String
Item identifier |
description |
Type: String
The suggested formatted answer |
matched_substrings |
Type: Array
Contains an array with offset value and length. These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired. |
type |
Type: String
requested prediction type (‘locality’, ‘postal_code’, ‘country’, ‘admin_level’, ‘train_station’, ‘metro_station’, ‘shopping’, ‘airport’, ‘museum’, ‘zoo’, ‘amusement_park’, ‘art_gallery’, ‘tourist_attraction’, ‘address’) |
ComponentRestrictions object Specification 🔗
Properties | |
country |
Type: String| Restricts predictions to the specified country (ISO 3166-1 Alpha-2 country code, case insensitive). For example, ‘fr’, ‘gb’, or ‘es’. You can provide a single one, or an array of country code strings. |
DetailsResponseItem object Specification 🔗
Properties | |
public_id |
Type: String
Item identifier |
name |
Type: String
Item name |
geometry |
Type: Object
Item geometry ( |
formatted_address |
Type: String
String containing the human-readable address of this item. |
types |
Type: Array
Types of the given item (like |
address_components |
Type: Array
Array containing the separate components applicable to this address. Each component has a long name (full text description or name of the address component), a short name (abbreviated textual name for the address component, if available) and types (array indicating the type of the address component like |