Configuration

An object defining configuration options for the Map widget.

accessKey

Specifies the shortcut key that sets focus on the widget.

Type:

String

Default Value: null

The value of this option will be passed to the accesskey attribute of the HTML element that underlies the widget.

activeStateEnabled

Specifies whether or not the widget changes its state when interacting with a user.

Type:

Boolean

Default Value: false

This option is used when the widget is displayed on a platform whose guidelines include the active state change for widgets.

autoAdjust

Specifies whether the widget automatically adjusts center and zoom option values when adding a new marker or route, or if a new widget contains markers or routes by default.

Type:

Boolean

Default Value: true

If autoAdjust is enabled, zoom is set to the maximum value allowing all markers and routes to be displayed at the same time. The center is changed so that markers and routes are aligned with the widget's center. Set the autoAdjust option to false to disable this behavior.

Note that the zoom level can only be automatically decreased to display all markers and routes. If the current zoom level allows all routes and markers to be displayed on the map, it remains unchanged.

center

An object, a string, or an array specifying which part of the map is displayed at the widget's center using coordinates. The widget can change this value if autoAdjust is enabled.

Type:

Object

|

String

|

Array

You can specify the center value in one of the following formats:

  • { lat: 40.749825, lng: -73.987963}
  • "40.749825, -73.987963"
  • [40.749825, -73.987963]
  • 'Brooklyn Bridge,New York,NY'

When you use the Map as an ASP.NET MVC Control, this option accepts either a string value indicating the address, or two double type values indicating the coordinates.

Razor C#
Razor VB
@(Html.DevExtreme().Map()
    .Center("Brooklyn Bridge,New York,NY")
    // ===== or =====
    .Center(40.74982, -73.987963)
)
@(Html.DevExtreme().Map() _
    .Center("Brooklyn Bridge,New York,NY") _
    ' ===== or =====
    .Center(40.74982, -73.987963)
)

controls

Specifies whether or not map widget controls are available.

Type:

Boolean

Default Value: false

Assign a Boolean value to this option to enable or disable all controls at once - both the map navigation control and the map type control.

disabled

Specifies whether the widget responds to user interaction.

Type:

Boolean

Default Value: false

elementAttr

Specifies the attributes to be attached to the widget's root element.

Type:

Object

Default Value: {}

You can configure this option in an ASP.NET MVC Control as follows:

Razor C#
Razor VB
@(Html.DevExtreme().WidgetName()
    .ElementAttr("class", "class-name")
    // ===== or =====
    .ElementAttr(new {
        @id = "elementId",
        @class = "class-name"
    })
    // ===== or =====
    .ElementAttr(new Dictionary<string, object>() {
        { "id", "elementId" },
        { "class", "class-name" }
    })

)
@(Html.DevExtreme().WidgetName() _
    .ElementAttr("class", "class-name")
    ' ===== or =====
    .ElementAttr(New With {
        .id = "elementId",
        .class = "class-name"
    })
    ' ===== or =====
    .ElementAttr(New Dictionary(Of String, Object) From {
        { "id", "elementId" },
        { "class", "class-name" }
    })
)

focusStateEnabled

Specifies whether the widget can be focused using keyboard navigation.

Type:

Boolean

Default Value: false, true (generic)

height

Specifies the widget's height.

Type:

Number

|

String

|

Function

Default Value: 300

This option accepts a value of one of the following types.

  • Number
    The height of the widget in pixels.

  • String
    A CSS-accepted measurement of height. For example, "55px", "80%", "auto", "inherit".

  • Function
    A function returning either of the above. For example:

    JavaScript
    height: function() {
        return window.innerHeight / 1.5;
    }

hint

Specifies text for a hint that appears when a user pauses on the widget.

Type:

String

Default Value: undefined

hoverStateEnabled

Specifies whether the widget changes its state when a user pauses on it.

Type:

Boolean

Default Value: false

key

A key used to authenticate the application within the required map provider.

Type:

String

|

Object

Default Value: ''

This option can hold a string representing an authentication key of a certain provider. In addition, this option can hold an object with specified keys for every used provider: { bing: BINGAPIKEY, google: GOOGLEAPIKEY, googleStatic: GOOGLESTATICAPI_KEY}.

For more information on authentication keys, see the required map provider documentation.

NOTE
The value of this option cannot be changed dynamically.

markerIconSrc

A URL pointing to the custom icon to be used for map markers.

Type:

String

To set a custom icon for an individual marker, specify the iconSrc field of the corresponding marker data source object.

View Demo

markers[]

An array of markers displayed on a map.

Type:

Array

If you use the Knockout approach when working with the Map widget, you can pass an observable array to the markers option to easily manage markers.

View Demo

onClick

A handler for the click event.

Type:

Function

|

String

Function parameters:
e:

Object

Provides function parameters.

Object structure:
component:

Object

Provides access to the widget's instance.

element:

jQuery

An HTML element of the widget.

model:

Object

Provides access to the data that is available for binding against the element. Available only in the Knockout approach.

location:

Object

Specifies the location of the clicked point on the map (if the 'google' or 'bing' provider is used).

jQueryEvent:

jQuery.Event

The jQuery event that caused action execution (if a static google provider is used).

Default Value: null

Assign a function to perform a custom action when the map is clicked.

To navigate to a specific URL when the click event fires, assign that URL or the anchor part (#) of that URL directly to this option as a string.

onDisposing

A handler for the disposing event. Executed when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
component:

Object

element:

jQuery

The widget's container.

model:

Object

The model data. Available only if you use Knockout.

Default Value: null

onInitialized

A handler for the initialized event. Executed only once, after the widget is initialized.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
component:

Object

element:

jQuery

The widget's container.

Default Value: null

You cannot access widget elements in this handler because it is executed before they are ready.

onMarkerAdded

A handler for the markerAdded event.

Type:

Function

Function parameters:
e:

Object

Provides function parameters.

Object structure:
component:

Object

Provides access to the widget's instance.

element:

jQuery

An HTML element of the widget.

model:

Object

Provides access to the data that is available for binding against the element. Available only in the Knockout approach.

options:

Object

Returns the object that defines the currently added marker in the "markers" array

originalMarker:

Object

Returns an original marker object used by the current map provider (only for 'google' and 'bing' providers).

Default Value: null

Assign a function to perform a custom action after a marker is added to the map.

onMarkerRemoved

A handler for the markerRemoved event.

Type:

Function

Function parameters:
e:

Object

Provides function parameters.

Object structure:
component:

Object

Provides access to the widget's instance.

element:

jQuery

An HTML element of the widget.

model:

Object

Provides access to the data that is available for binding against the element. Available only in the Knockout approach.

options:

Object

Returns the object that defines the currently removed marker in the "markers" array.

Default Value: null

Assign a function to perform a custom action after a marker is removed from the map.

onOptionChanged

A handler for the optionChanged event. Executed after an option of the widget is changed.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
component:

Object

name:

String

A short name of the option whose value has been changed.

fullName:

String

A full name of the option whose value has been changed; contains a full hierarchy of the option.

value: any

A new value for the option.

element:

jQuery

The widget's container.

model:

Object

The model data. Available only if you use Knockout.

Default Value: null

onReady

A handler for the ready event.

Type:

Function

Function parameters:
e:

Object

Provides function parameters.

Object structure:
component:

Object

Provides access to the widget's instance.

element:

jQuery

An HTML element of the widget.

model:

Object

Provides access to the data that is available for binding against the element. Available only in the Knockout approach.

originalMap:

Object

Provides access to the map instance of the current provider.

Default Value: null

Assign a function to perform a custom action after a map is rendered.

onRouteAdded

A handler for the routeAdded event.

Type:

Function

Function parameters:
e:

Object

Provides function parameters.

Object structure:
component:

Object

Provides access to the widget's instance.

element:

jQuery

An HTML element of the widget.

model:

Object

Provides access to the data that is available for binding against the element. Available only in the Knockout approach.

options:

Object

Returns the object that defines the currently added route in the "routes" array.

originalRoute:

Object

Returns an original route object used by the current map provider (only for 'google' and 'bing' providers).

Default Value: null

Assign a function to perform a custom action after a route is added to the map.

onRouteRemoved

A handler for the routeRemoved event.

Type:

Function

Function parameters:
e:

Object

Provides function parameters.

Object structure:
component:

Object

Provides access to the widget's instance.

element:

jQuery

An HTML element of the widget.

model:

Object

Provides access to the data that is available for binding against the element. Available only in the Knockout approach.

options:

Object

Returns the object that defines the currently removed route in the "markers" array.

Default Value: null

Assign a function to perform a custom action after a route is removed from the map.

provider

The name of the current map data provider.

Type:

String

Default Value: 'google'
Accepted Values: 'bing' | 'google' | 'googleStatic'

Use the "googleStatic" provider to connect route points directly rather than by following the street layout.

NOTE
Most browsers use Bing Maps V8, except Internet Explorer 9 and 10, which fall back to V7.

When using the widget as an ASP.NET MVC Control, specify this option using the GeoMapProvider enum. This enum accepts the following values: Bing, Google, and GoogleStatic.

View Demo

routes[]

An array of routes shown on the map.

Type:

Array

rtlEnabled

Switches the widget to a right-to-left representation.

Type:

Boolean

Default Value: false

When this option is set to true, the widget text flows from right to left, and the layout of elements is reversed. To switch the entire application/site to the right-to-left representation, assign true to the rtlEnabled field of the object passed to the DevExpress.config(config) method.

JavaScript
DevExpress.config({
    rtlEnabled: true
});

tabIndex

Specifies the number of the element when the Tab key is used for navigating.

Type:

Number

Default Value: 0

The value of this option will be passed to the tabindex attribute of the HTML element that underlies the widget.

type

The type of a map to display.

Type:

String

Default Value: 'roadmap'
Accepted Values: 'hybrid' | 'roadmap' | 'satellite'

The available option values are based on map types supported by the Google map provider. If you use the Bing map, the widget casts the option value to the appropriate value supported by the "Bing" provider.

  • hybrid -> Aerial
  • roadmap -> Road

When using the widget as an ASP.NET MVC Control, specify this option using the GeoMapType enum. This enum accepts the following values: Hybrid, Roadmap and Satellite.

View Demo

visible

Specifies whether the widget is visible.

Type:

Boolean

Default Value: true

width

Specifies the widget's width.

Type:

Number

|

String

|

Function

Default Value: 300

This option accepts a value of one of the following types.

  • Number
    The width of the widget in pixels.

  • String
    A CSS-accepted measurement of width. For example, "55px", "80%", "auto", "inherit".

  • Function
    A function returning either of the above. For example:

    JavaScript
    width: function() {
        return window.innerWidth / 1.5;
    }

zoom

The map's zoom level. The widget can change this value if autoAdjust is enabled.

Type:

Number

Default Value: 1