Edit this page

SchedulerResourceCollection Object

The SchedulerResourceCollection client-side object represents a list of Resources defined in the Scheduler.

The tables below lists the most important methods of the SchedulerResourceCollection client-side object.


Name Parameters Return Type Description
get_count() None Int Gets the number of Resources in the collection. See Example 1.
add() Resource None Adds the specified Resource to the collection. See Example 1.
clear() None None Clears the collection of all Resources in it.
forEach() function SchedulerResourceCollection Gets the collection of all Resources. See Example 1.
getResource() Int Resource Gets the Resource at the specified index in the collection.
getResourceByType() String Resource Gets the Resource of a specified type in the collection. See Example 1.
getResourcesByType() String SchedulerResourceCollection Gets a list of all Resources of the specified type.
getResourceByTypeAndKey() String, String Resource Gets a Resources of the specified type and key. See Example 1.
insert() Int (index), Resource None Inserts the specified Resource at the specified index in the collection.
remove() Resource None Removes the specified Resource (if it exists) from the collection.
removeAt() Int None Removes the Resource at the specified index from the collection.

Example 1: Update the appointment's resources.

function OnClientAppointmentClick(sender, args) {
    var appointment = args.get_appointment();
    var resources = appointment.get_resources();
    resources.forEach(function (res) {
    if (resources.get_count() != 0) {
        sender.updateAppointment(appointment, false);
    else {
        //Find the resource corresponding to the clicked item
        var room = sender.get_resources().getResourceByTypeAndKey("Room", "2");
        //Add it to the appointment resources collection
        sender.updateAppointment(appointment, false);

See Also