Methods

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

applySettings(settings)

Applies the layer element settings and updates element appearance.

Parameters:
settings:

Object

A configuration object for the element.

The settings object should contain one or more options to be changed for the layer element. The options available to change using this method are listed in the layers option description.

Note that you cannot change the dataSource option for a separate layer element.

Show Example:
jQuery

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


                                    

                                    

attribute(name)

Gets the value of an attribute.

Parameters:
name:

String

The name of an attribute.

Return Value: any

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.


                                    

                                    

attribute(name, value)

Sets the value of an attribute.

Parameters:
name:

String

The name of an attribute.

value: any

The new attribute value.

coordinates()

Gets the layer element coordinates.

Return Value:

Object

The element coordinates.

selected()

Gets the selection state of the layer element.

Return Value:

Boolean

Is true when the element is selected, otherwise, false.

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 the selection state of the layer element.

Parameters:
state:

Boolean

Pass true to select the element and false to deselect it.

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.