resources[]

Specifies an array of resources available in the scheduler.

Type:

Array<Object>

Default Value: []

Each element of this array is an object that defines a resource kind - a room, a car or any other resource kind. A resource kind object must have at least the following fields.

  • dataSource
    Specify the available resources of this kind (room1, room2, etc.).

  • fieldExpr
    The name of the appointment object field that specifies a resource of this kind (e.g., "room").

There are more fields that can be specified within a resource kind object. They are listed below. For details on how to define a resource and assign it to scheduler appointments, refer to the Resources article.

See Also

allowMultiple

Indicates whether or not several resources of this kind can be assigned to an appointment.

Type:

Boolean

Default Value: false

When this field is set to true, the TagBox widget is used in the Appointment popup window to specify resources for the current appointment. Alternatively, the SelectBox widget is used.

colorExpr

Specifies the resource object field that is used as a resource color.

Type:

String

Default Value: 'color'

The resource color is used to indicate appointments related to this resource.

dataSource

A data source used to fetch resources to be available in the scheduler.

Default Value: null

This option accepts one of the following.

  • Array of objects
    A simple JavaScript array containing a collection of plain objects.

  • URL
    The URL of a JSON file or service that returns JSON data.

  • DataSource or its configuration object
    The DataSource is an object that provides an API for data processing. The DataSource's underlying data access logic is isolated in a store. Refer to the Data Layer and DataSource Examples guides for more information about the DataSource.

    NOTE
    Turn the DataSource's pagination off to prevent data from partitioning.
NOTE
Data field names should not contain the following characters: ., ,, :, [, and ]. Their presence may cause issues in the widget's operation.

The resource objects must have particular fields so that the Scheduler widget can present the resources for end users. For details, refer to the Define Resources topic.

displayExpr

Specifies which field from the resource data objects provides values to be displayed in the resource editor.

Type:

String

|

Function

Function parameters:
resource:

Object

The current resource's data object.

Default Value: 'text'

Set this option to the name of a data field that provides displayed values...

displayExpr: "name"

... or to a function that combines the values of several data fields to create the displayed value:

displayExpr: function(item) {
    // "item" can be null
    return item && 'ID: ' + item.id + ', Name: ' + item.name;
}
See Also

fieldExpr

The name of the appointment object field that specifies a resource of this kind.

Type:

String

Default Value: ''

Use this option to declare how to call an appointment field to specify a resource of this kind. In addition, the value of this option is used to define grouping by resources in the scheduler.

label

Specifies the label of the Appointment popup window field that allows end users to assign a resource of this kind.

Type:

String

Default Value: ''

useColorAsDefault

Specifies whether appointments are colored like this resource kind.

Type:

Boolean

Default Value: false

Appointments that have a single resource kind inherit its color. Appointments with several resource kinds are colored like the one whose useColorAsDefault option is set to true, which is the last resource kind in the resources array by default.

valueExpr

Specifies the resource object field that is used as a value of the Resource editor in the Appointment popup window.

Type:

String

|

Function

Default Value: 'id'

End users can use a field in the Appointment pop-up window to choose a resource for the appointment. The label field of the resource kind object specifies this field's label. The editor that is used to select a resource depends on the value of the allowMultiple field. The TagBox widget is used when multiple selection is possible, and the SelectBox widget is used when only a single resource can be selected. These widgets have the displayExpr and valueExpr options to specify the displayed text and the selected item's actual value. These options are set to the displayExpr and valueExpr field values of the resource kind object.

NOTE
You cannot specify valueExpr as a function when the widget is bound to a remote data source. This is because valueExpr is used in a filter the widget sends to the server when querying data. Functions with custom logic cannot be serialized for this filter.