Documentation
Reference
2.1.38 (current version)
collection
interactivityModel
Interfaces

data.Manager

Extends IDataManager, IFreezable.

Custom data manager.

Constructor | Fields | Events | Methods

Constructor

data.Manager(data)

Parameters:

ParameterDefault valueDescription
data *
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Object

Data.

* Mandatory parameter/option.

Fields

NameTypeDescription
eventsIEventManager

Event manager for the object.

Inherited from IFreezable.

Events

NameDescription
change

Change to the internal state of the object.

Inherited from IFreezable.

Methods

NameReturnsDescription
freeze()IFreezable

Switches the object to "frozen" mode.

Inherited from IFreezable.

get(path[, defaultValue])Object

Returns the value of the data field with the specified name.

getAll()Object

Returns an object containing all the data fields.

isFrozen()Boolean

Returns true if the object is in "frozen" mode, otherwise false.

Inherited from IFreezable.

set(path[, value])data.Manager

Sets values for the specified fields. Two signatures are supported:

  • A single argument consisting of a {"name": "value"} object.
  • Two arguments, the first of which is the field name, and the second the value.
The name can reference nested fields, i.e. it can contain '.'.

setAll()data.Manager

Completely overwrites all data fields. Equal to consecutive calls of the "unsetAll" and "set" methods, but with better performance.

unfreeze()IFreezable

Switches the object to active mode.

Inherited from IFreezable.

unset(path)data.Manager

Clears the specified data fields.

unsetAll()data.Manager

Clears all data fields.

Methods details

get

{Object} get(path[, defaultValue])

Returns the value of the data field with the specified name.

Parameters:

ParameterDefault valueDescription
path*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: String

String with the name of a data field. The name can reference nested fields, i.e. it can contain '.'.

defaultValue

Type: Object

Default value.

* Mandatory parameter/option.

getAll

{Object} getAll()

Returns an object containing all the data fields.

set

Sets values for the specified fields. Two signatures are supported:

  • A single argument consisting of a {"name": "value"} object.
  • Two arguments, the first of which is the field name, and the second the value.
The name can reference nested fields, i.e. it can contain '.'.

Returns a self-reference.

Parameters:

ParameterDefault valueDescription
path*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Object | String

A string containing the name of a data field, or an object of the type {"field name": "value"}.

value

Type: Object

The value, if the string containing the field name is passed as the first argument.

* Mandatory parameter/option.

Example:

var balloonData = new ymaps.data.Manager({
     balloonContentHeader: 'Balloon title'
});
balloonData.set({
    balloonContentBody: 'Balloon content',
    balloonContentFooter: '<a href="//ya.ru">test</a>'
});

setAll

{data.Manager} setAll()

Completely overwrites all data fields. Equal to consecutive calls of the "unsetAll" and "set" methods, but with better performance.

Returns a self-reference.

Parameters:

ParameterDefault valueDescription
data*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type:

* Mandatory parameter/option.

unset

Clears the specified data fields.

Returns a self-reference.

Parameters:

ParameterDefault valueDescription
path*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: String | String[]

Field name, or an array of names.

* Mandatory parameter/option.

unsetAll

{data.Manager} unsetAll()

Clears all data fields.

Returns a self-reference.