Resource Object
This is the data structure that is accepted and emitted for resources.
id |
Uniquely identifies this resource. Event Objects with a corresponding resourceId field will be linked to this event.
Will be coerced into a string.
|
---|---|
title | Text that will be displayed on the resource when it is rendered. |
eventColor |
Events associated with this resources will have their backgrounds and borders colored. Any CSS string color format can be specified, like "#f00" or "rgb(255,0,0)" . This value will take precedence over the global eventColor option and the Event Source Object color option, but it will not take precedence over the Event Object color option.
|
eventBackgroundColor |
Like eventBackgroundColor but only for the background color
|
eventBorderColor |
Like eventBorderColor but only for the border color
|
eventTextColor |
Like eventTextColor but only for the text color
|
eventClassNames | className(s) that will apply to events |
businessHours | A businessHours declaration that will only apply to this resource. See example. |
children | See below |
parentId | See below |
parent | See below |
For the color-related properties, even when an event is rendered on a non-resource view (views other than Timeline), these properties will still take effect.
Resources can be nested within each other. This will be displayed as an expander arrow in the UI which expands and contracts the child resources. Specifying nested resources can be done via one of two possible techniques…
Nested resources with a nested array
Child resources can be specified directly within the parent resource via the children
property. This technique is often more pleasant when hardcoding an array because it is visually easier to understand the code.
resources: [
{
id: 'a',
title: 'Room A',
children: [
{
id: 'a1',
title: 'Room A1'
},
{
id: 'a2',
title: 'Room A2'
}
]
}
]
Nested resources with a flat array
An alternative method for specify child resources is via linking them together with the parentId
property. This is often more pleasant when dealing with resource data that originates from a database.
resources: [
{
id: 'a',
title: 'Room A'
},
{
id: 'a1',
parentId: 'a',
title: 'Room A1'
},
{
id: 'a2',
parentId: 'a',
title: 'Room A2'
}
]
The parent
and children
properties
Regardless of which method is used to set the parent/child relationship, the resulting Resource Objects throughout the API will still get the parent
and children
properties assigned.
parent
is a reference to the parent Resource Object. It will be null
if there is no parent.
children
is an array of child Resource Objects.