Methods

This section describes the methods that can be used in code to manipulate the Marker object.

applySettings(settings)

Applies the marker settings specified as a parameter and updates the marker appearance.

Parameters:
settings: Object
A configuration object for the marker.

The settings object should contain options to be changed for a certain marker. These options are listed below.

Show Example:
jQuery

Click the button below the map to highlight the markers one-by-one.


                                    

                                    

attribute(name)

Returns the value of an attribute.

Parameters:
name: String
The name of an attribute.
Return Value: Object|Array|Number|String|Boolean
The value of the required attribute.

The map marker data source can contain an object of attributes assigned to the attributes field. These attributes can hold any information you require. To obtain the value of an attribute, call the attribute(name) method with the name of the required attribute passed as the parameter.

Show Example:
jQuery

In this example, the attribute(name) method is used to obtain the name of the marker that is currently hovered over. This name is displayed by a tooltip.


                                    

                                    

coordinates()

Returns the coordinates of a specific marker.

Return Value: Array
The coordinates of a specific marker.

This method returns an array containing the coordinates of a marker in the [longitude, latitude] format.

selected()

Provides information about the selection state of a marker.

Return Value: Boolean
Selection state of the marker.

When a marker is selected, this method returns true. Otherwise, the returned value is false. To select/deselect a marker at runtime, use the selected(state) method.

Show Example:
jQuery

In this example, the selected() method is used to check whether the clicked marker is already selected. If so, this marker deselects using the selected(state) method. Otherwise, it selects using the same method.


                                    

                                    

selected(state)

Sets a new selection state for a marker.

Parameters:
state: Boolean
Specifies whether to select or deselect the marker.

To select a marker, pass true as the parameter. Otherwise, pass false. To specify the selection state of a certain marker when configuring dxVectorMap, use the isSelected field of the object returned by the customize function.

Show Example:
jQuery

In this example, the selected() method is used to check whether the clicked marker is already selected. If so, this marker deselects using the selected(state) method. Otherwise, it selects using the same method..