data.Manager
Extends IDataManager, IFreezable.
Custom data manager.
Constructor | Fields | Events | Methods
Constructor
data.Manager(data)
Parameters:
Parameter |
Default value |
Description |
|
— |
Type: Object Data. |
* Mandatory parameter/option.
Fields
Name |
Type |
Description |
Event manager for the object. Inherited from IFreezable. |
Events
Name |
Description |
Change to the internal state of the object. Inherited from IFreezable. |
Methods
Name |
Returns |
Description |
freeze() |
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. |
Sets values for the specified fields. Two signatures are supported:
|
||
setAll() |
Completely overwrites all data fields. Equal to consecutive calls of the "unsetAll" and "set" methods, but with better performance. |
|
unfreeze() |
Switches the object to active mode. Inherited from IFreezable. |
|
Clears the specified data fields. |
||
unsetAll() |
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 |
|
— |
Type: String String with the name of a data field. The name can reference nested fields, i.e. it can contain '.'. |
— |
Type: Object Default value. |
* Mandatory parameter/option.
getAll
{Object} getAll()
Returns an object containing all the data fields.
set
{data.Manager} set(path[, value])
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 |
|
— |
Type: Object|String A string containing the name of a data field, or an object of the type {"field name": "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 |
|
— |
Type: |
* Mandatory parameter/option.
unset
{data.Manager} unset(path)
Clears the specified data fields.
Returns self-reference.
Parameters:
Parameter |
Default value |
Description |
|
— |
Type: String|String[] Field name, or an array of names. |
* Mandatory parameter/option.
unsetAll
{data.Manager} unsetAll()
Clears all data fields.
Returns self-reference.
Mandatory parameter/option.