New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

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.

 

NameParametersReturn TypeDescription
get_count()NoneIntGets the number of Resources in the collection. See Example 1.
add()ResourceNoneAdds the specified Resource to the collection. See Example 1.
clear()NoneNoneClears the collection of all Resources in it.
forEach()functionSchedulerResourceCollectionGets the collection of all Resources. See Example 1.
getResource()IntResourceGets the Resource at the specified index in the collection.
getResourceByType()StringResourceGets the Resource of a specified type in the collection. See Example 1.
getResourcesByType()StringSchedulerResourceCollectionGets a list of all Resources of the specified type.
getResourceByTypeAndKey()String, StringResourceGets a Resources of the specified type and key. See Example 1.
insert()Int (index), ResourceNoneInserts the specified Resource at the specified index in the collection.
remove()ResourceNoneRemoves the specified Resource (if it exists) from the collection.
removeAt()IntNoneRemoves the Resource at the specified index from the collection.

Example 1: Update the appointment's resources.

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

See Also

In this article
See Also
Not finding the help you need?
Contact Support