Configuration

An object defining configuration options for the dxMap widget.

activeStateEnabled

A Boolean value specifying whether or not the widget changes its state when interacting with a user.

Type: Boolean
Default Value: true

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

clickAction

An action performed when a widget is clicked.

Type: Action
Default Value: null

Show Example:
jQuery

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.

Show Example:
jQuery

disabled

A Boolean value specifying whether or not the widget can respond to user interaction.

Type: Boolean
Default Value: false

Create an observable variable and assign it to this option to specify the availability of the widget at runtime.

Show Example:
jQuery

height

Specifies the height of the widget.

Type: Number
Default Value: 300

The option can hold a value of the following types.

  • numeric - the height of the widget in pixels
  • string - a CSS measurement of the widget height (e.g., "55px", "80%", "auto" and "inherit")
  • function - a function returning the widget height (e.g., height:function(){ return baseHeight - 10 + "%"; })

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: "apikey", google: "apikey", googleStatic: "api_key"}.

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

NOTE: The value of this option cannot be changed dynamically.

location

An object, a string, or an array specifying the current location.

You can specify the location 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'

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.

markers

An array of markers displayed on a map.

Type: Array

An item of the array assigned to the markers option is an object containing the following properties.

  • location (required) - an object, a string, or an array specifying the marker location (see the location option description).
  • tooltip (optional) - takes on an object containing the text and isShown fields. The text field specifies the tooltip text. The isShown field takes on a Boolean value that specifies whether a tooltip is visible by default or not. If the tooltip should be hidden by default, pass the tooltip text directly to the tooltip property.
  • clickAction (optional)- an action performed when the marker is clicked.
  • iconSrc (optional) - a URL pointing to the custom icon to be used for the marker.
Show Example:
jQuery

provider

The name of the current map data provider.

Type: String
Default Value: "google"
Accepted Values: 'bing'|'google'|'googleStatic'

Show Example:
jQuery

readyAction

An action that is performed after a map is rendered.

Type: Action
Default Value: null

An object passed to the action function assigned to this option can have the following fields in addition to the basic field set.

  • originalMap - Contains the map that is received from the provider.

routes

An array of routes shown on the map.

Type: Array

An item of the array assigned to the routes option is an object containing the following fields.

  • locations (required)
    Contains an array of locations making up the route.
  • mode (optional)
    Specifies a transportation mode to use in the displayed route. Acceptable values: 'driving' (set by default) and 'walking'.
  • color (optional)
    Specifies the color of the line displaying the route.
  • weight (optional)
    Specifies the thickness of the line displaying the route in pixels.
  • opacity (optional)
    Specifies the opacity of the line displaying the route.
Show Example:
jQuery

type

The type of a map to display.

Type: String
Default Value: "roadmap"
Accepted Values: 'hybrid'|'roadmap'

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
Show Example:
jQuery

visible

A Boolean value specifying whether or not the widget is visible.

Type: Boolean
Default Value: true

width

Specifies the width of the widget.

Type: Number
Default Value: 300

The option can hold a value of the following types.

  • numeric - the widget width in pixels
  • string - a CSS measurement of the widget width (e.g., "55px", "80%", "auto" and "inherit")
  • function - the function returning the widget width (e.g., width:function(){ return baseWidth - 10 + "%"; })

zoom

The zoom level of the map.

Type: Number
Default Value: 1

Note that the map provider sets the automatically calculated zoom value each time a marker or a route is added to the map. In this case, zoom is set to the maximum value, allowing all markers and routes to be displayed at the same time. If you need to restore the specified zoom level, just update the option value after the marker or route has been added.

JavaScript
mapZoom = ko.observable(0);
$("#dxMapContainer").dxMap("instance").addMarker(markerOptions)
    .done(function(){
        mapZoom(0);
    });

If the dxMap widget includes markers or routes initially, specify the required zoom level within the readyAction handler.

JavaScript
mapZoom = ko.observable(0);
dxMapOptions = {
    location: '55.749825, -73.987963',
    zoom: mapZoom,
    markers: [
        { location: '40.749825, -73.987963' },
        { location: '41.749825, -72.987963' },
    ],
    readyAction: function () {
        mapZoom(0);
    }
}
Show Example:
jQuery