Localities Widget Reference 2.0
Localities Javascript Widget Reference 2.0- Autocomplete class
- AutocompleteParameters Interface
- AutocompleteResponse Interface
- AutocompleteResponseItem Interface
- ComponentRestrictions Interface
- DetailsResponseItem Interface
Autocomplete class
woosmap.localities.AutocompleteAutocompleteElementsHandler.
Autocomplete
| Constructor |
Autocomplete(inputId, customConfig?)Parameters:
|
| Methods | |
addListener(eventName, callback)Parameters:
Return Type:
EventAdds an event listener to the widget Can be removed using removeListener() with the same arguments | |
removeListener(eventName, callback)Parameters:
Removes given event listener from the widget | |
getSelectedSuggestionDetails()Parameters:
None
Return Type:
DetailsResponseItemReturns the latest user-selected locality among search results | |
getAutocompleteSuggestions()Parameters:
None
Return Type:
AutocompleteResponseReturns the latest search results | |
setTypes(types)Parameters:
Sets the types to query | |
setCustomDescription(customDescription)Parameters:
Sets the custom description to query | |
setComponentRestrictions(components)Parameters:
Sets the component restrictions | |
AutocompleteParameters Interface
| Properties | |
|
Type:
ComponentRestrictionsrestricts predictions to selected components | |
|
Type:
StringThis parameter allows to choose the description format for all or some of the suggestion types selected. The custom formats are described as follows:
| |
|
Type:
StringDefaults to ‘standard’, can be set to ‘advanced’ to retrieve postal codes outside western Europe | |
|
Type:
Numberprevents autocomplete requests from being sent unnecessarily often. Default is no debounce. | |
|
Type:
Stringcan be set to ‘postal_code’ to search localities by name or postal codes | |
|
Type:
Numberall tabindexes in Autocomplete will start from that tabindex. Defaults to 0. | |
|
Type:
Stringexpected response language. Default is the country local or browser language | |
|
Type:
LatLngLiteralThis parameter is used to add a bias to the autocomplete feature. The location defines the point around which to retrieve results in priority. | |
|
Type:
NumberNumber of characters before sending request to Localities API | |
|
Type:
StringThe types queried (example ‘locality’, ‘postal_code’, ‘country’ ; omit param for ‘locality’ + ‘postal_code’) | |
AutocompleteResponse Interface
| Properties | |
|
Type:
AutocompleteResponseItemArray with Autocomplete items | |
AutocompleteResponseItem Interface
| Properties | |
|
Type:
StringThe suggested formatted answer | |
|
Type:
arrayContains 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:
StringItem identifier | |
|
Type:
Stringrequested prediction type (‘locality’, ‘postal_code’, ‘country’, ‘admin_level’, ‘train_station’, ‘metro_station’, ‘shopping’, ‘airport’, ‘museum’, ‘zoo’, ‘amusement_park’, ‘art_gallery’, ‘tourist_attraction’, ‘address’) | |
ComponentRestrictions Interface
| Properties | |
|
Type:
StringRestricts 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 Interface
| Properties | |
|
Type:
arrayArray 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 | |
|
Type:
stringString containing the human-readable address of this item. | |
|
Type:
objectItem geometry ( | |
|
Type:
stringItem name | |
|
Type:
stringItem identifier | |
|
Type:
arrayTypes of the given item (like | |