data.Manager

Extends IDataManager, IFreezable.

Custom data manager.

Constructor | Fields | Events | Methods

Constructor

data.Manager(data)

Parameters:

Parameter Default value Description
data *

Type: Object

Data.

* Mandatory parameter/option.

Fields

Name Type Description
events IEventManager

Event manager for the object.

Inherited from IFreezable.

Events

Name Description
change

Change to the internal state of the object.

Inherited from IFreezable.

Methods

Name Returns Description
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 is the field name, and the second is 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:

Parameter Default value Description
path *

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 is the field name, and the second is the value.
The name can reference nested fields, i.e. it can contain '.'.

Returns self-reference.

Parameters:

Parameter Default value Description
path *

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 self-reference.

Parameters:

Parameter Default value Description
data *

Type:

* Mandatory parameter/option.

unset

Clears the specified data fields.

Returns self-reference.

Parameters:

Parameter Default value Description
path *

Type: String|String[]

Field name, or an array of names.

* Mandatory parameter/option.

unsetAll

{data.Manager} unsetAll()

Clears all data fields.

Returns self-reference.