VIAMICHELIN JAVASCRIPT API


Reference

The completion address component is called ViaMichelin.Api.Completion.Address. It works with the VMLaunch method by specifying 2 parameters : conf and callbacks. 

conf : configuration of the component 

callbacks: event listeners of the component

VMLaunch("ViaMichelin.Api.Completion.Address", conf, callbacks);

Configuration

The input field (required)

(node) input

                This parameter allows you to specify the input field that the completion is hooked

Paramètres de regroupement

(boolean) grouping

                This parameter has to be set at « true » if you want to group the suggestions by type

(object) groupingOptions

                This parameter is used in case of use of the grouping option (grouping=true).

(object) groupingOptions.labels

                Contains labels which represent the column names of each group of suggestions.

(string) groupingOptions.labels.COUNTRY

                Represents the label of the country name group.

(string) groupingOptions.labels.ADMIN

                Represents the label of the administrative area group.

(string) groupingOptions.labels.CITY

                Represents the label of the cities group.

(string) groupingOptions.labels.ADDRESS

                Represents the label of the address group.

The search parameters

The parameters of the search must be grouped on an object called parameters.

(string) parameters.exclusiveCountry

                ISO Code country with 3 letters

                It allows to specify the country where the request will be carried out. Without this parameter, the request is carried out all over the world.

(string) parameters.favoriteCountry

                ISO Code country with 3 letters

                It allows to specify the country where the request will prioritized.

(string) parameters.favoriteCountrySpacial

                ISO Code country with 3 letters

                It permits to specify the country where the request will prioritized. The option includes also the countries around for the search.

(string) parameters.lang

                ISO Code country with 3 letters

                It allows to specify the language

(number) parameters.maxResults

                It allows to limit the quantity of the suggestions required.

(number) parameters.maxResultsCountry

                It allows to limit the quantity of the suggestions required for the country parameter.

(number) parameters.maxResultsAdmin

                It allows to limit the quantity of the suggestions required for the administrative area parameter.

(number) parameters.maxResultsCity

                It allows to limit the quantity of the suggestions required for the city parameter.

(number) parameters.maxResultsAddress

                It allows to limit the quantity of the suggestions required for the address parameter.

The style-sheet parameters

(string) wrapperClassName

                This parameter allows you to add a CSS class on the highest container of the list of suggestions.

(string) activeLineClassName

                  This parameter allows you to change the class of the line selected.

(string) lineClassName

                   This parameter allows you to change the class of each line of the result.            

Others parameters

(boolean) searchOnFocus

                This parameter must be set to “true” if you want to activate the option at the focus of the click.

(boolean) revertMode

                This parameter must be set to “true” if you want to display the list of suggestions above the input field and ordered from the bottom to the top.

 

Events

The listeners can be created for the following events.

The parameters related to the events are returned to the listeners.

onInit

     Triggered when the completion component is correctly loaded.

Parameters

  • component : reference of the component

onInitError

     Triggered  when an error occurs during the loading of the completion component.

Parameters

  • component : reference of the component
  • error : the error occurs

ready

     Triggered when the component is definitely loaded and ready for use

Parameters

Aucun

opened

     Trigerred when the list of suggestions displays.

Parameters

Aucun

noresult

     Triggered if no suggestion is proposed, after the input entry (instead of "opened").

Parameters

Aucun

selected

     Triggered when no suggestion is selected by the user.

Parameters

  • line : refer to the line selected

closed

        Triggered when the list of suggestions is closed, for any the reason.

Parameters

Aucun

None