OpenDashDataContext Class
Is available to data adapters.
Methods
OpenDashDataContext.get()
Same as $data.get()
. Returns an instance of OpenDashDataItem.
To set a new value to an item, use this method.
ctx.get('item.id').set('value', {
date: 1483225200000, // Unix millisecond timestamp.
value: 'Some value', // Depending on item type.
});
OpenDashDataContext.create(payload: Object)
Create a new OpenDashDataItem and save it in the data adapter.
Parameter
The parameter should be and object will the following properties:
- id: Unique identifier of the item.
- name: Name of the item.
- icon: (Optional) Path to the icon of the item.
- meta: (Optional) Object of meta information about the item.
- parent: (Optional) ID of the parent item.
- value: (Optional) Value Object for the current value.
- valueTypes: Array representing the types of the value.
{
valueTypes: [
{
name: 'Display Name',
type: 'Number', // One of the following Strings: Number, String, Boolean, Geo, Object
},
],
}
OpenDashDataContext.createContainer(payload: Object)
Create a new OpenDashDataContainer and save it in the data adapter.
Parameter
The parameter should be and object will the following properties:
- id: Unique identifier of the container.
- name: Name of the container.
- icon: (Optional) Path to the icon of the container.
- meta: (Optional) Object of meta information about the container.
- parent: (Optional) ID of the parent container.