Localities Widget Reference

Localities Javascript Widget Reference
  1. Autocomplete class
  2. AutocompleteLocalities object Specification
  3. AutocompleteParameters object Specification
  4. AutocompleteResponse object Specification
  5. ComponentRestrictions object Specification

Autocomplete class 🔗


woosmap.localities.Autocomplete

Constructor
Autocomplete(inputId:String, customConfig?:AutocompleteParameters)

Methods
addListener(eventName, callback)

Return Value: Event

Adds an event listener to the widget Can be removed using removeListener() with the same arguments

getLocalities()

Return Value: AutocompleteResponse

Returns the latest search results

getSelectedLocality()

Return Value: AutocompleteLocalities

Returns the latest user-selected locality among search results

removeListener(eventName, callback)

Removes given event listener from the widget

setComponentRestrictions(components:ComponentRestrictions)

Sets the component restrictions

setOptions(customConfig:AutocompleteParameters)

Sets new config options

setTypes(types:String)

Sets the types to query


AutocompleteLocalities object Specification  🔗


Properties
admin_0 Type: String

The country name associated to the prediction

admin_1 Type: String

The area name associated to the prediction

description Type: String

The suggested formatted answer

location Type: Latlngliteral

The location object

name Type: String

The location name

postal_codes Type: String|Array.<String>

Array of postal codes for suggested location (only returned for localities predictions)

type Type: String

requested prediction type (‘locality’ or ‘postal_code’)

viewpoint Type: Latlngboundsliteral

The preferred viewpoint when displaying this Locality on a map. This property will be null if the preferred viewport for the Locality is not known.


AutocompleteParameters object Specification  🔗


Properties
minimumInputLength Type: Number

Number of characters before sending request to Localities API

customDescription Type: String

How description will be written. Not used yet.

components Type: ComponentRestrictions

restricts predictions to selected components

types Type: String

The types queried (supports ‘locality’ and ‘postal_code’ ; omit param for both)

data Type: String

Defaults to ‘standard’, can be set to ‘advanced’ to retrieve postal codes outside western Europe

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.


AutocompleteResponse object Specification  🔗


Properties
localities Type: AutocompleteLocalities

Array with Autocomplete Localities


ComponentRestrictions object Specification  🔗


Properties
country Type: String|Array.<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.