new Events(oSchedule)
The Events object represents a collection of Event objects that define the control's appointments. It provides methods for managing events, such as adding, removing, or retrieving them, and is accessible through the Schedule.Events property. For instance, Events.Add() method creates and adds a new event into the control. Each event defines an appointment by its start and end date/time and is displayed in the schedule view as a bar (for durations) or a line (for instantaneous events). Additionally, the calendar panel highlights the dates that contain events, helping users quickly identify scheduled activity. Users can create events using drag-and-drop operations, which automatically updates the Events collection accordingly ("create" action in allowActions field).
Parameters:
| Name | Type | Description |
|---|---|---|
oSchedule |
Schedule | Indicates an object of Schedule type that owns the collection. |
Members
Count :number
The Count property returns the number of events within the collection. The Add, Remove, and Clear methods update the events collection, and consequently the count of events within the collection. The onaddevent event occurs once a new event has been added to the Events collection. The onremoveevent event occurs once an event has been removed from the Events collection. The Clear() method removes all events of the control, while the Remove() method removes an event giving its index, identifier/key or reference.
Type:
- number
Example
The following statements are equivalents:
oSchedule.Events.GetCount(), counts the events within the control
oSchedule.Events.Count, counts the events within the control
where oSchedule is an object of Schedule type
Count
Methods
Add(oEventOptsopt) → {Event}
The Add() method creates and adds a new event into the control. The Add() method supports one (options) or two parameters (start and end margins of the event), as shown in the example. The options should include at least one of the following combinations: start and end fields, start and duration fields, or end and duration fields of the event, as illustrated in the example. The options can include other event's properties such as caption, user data, and so on. The Add() method returns the newly created event, as an object of Event type. The Remove() method removes the event giving its index, identifier/key or reference. The Clear() method removes all events of the control. The onaddevent event occurs once a new event has been added to the Events collection.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
oEventOpts |
EventOptions |
<optional> |
Specifies the options to create the new event as an object of EventOptions type. |
Returns:
Returns the newly created event, as an object of Event type
- Type
- Event
Example
oSchedule.Events.Add({start: "#1/1/2001 10:00#", end: "#1/1/2001 13:00#"}), (one parameter) adds a new event from 10:00 AM to 1:00 PM on Jan 1st, 2001
oSchedule.Events.Add("#1/1/2001 10:00#", "#1/1/2001 13:00#"), (two-parameters) adds a new event from 10:00 AM to 1:00 PM on Jan 1st, 2001
Add
Clear()
The Clear() method removes all events of the control. The Schedule.Clear() method clears the events, groups and mark-zones. The onremoveevent event occurs once an event has been removed from the Events collection. The Remove() method removes an event giving its index, identifier/key or reference. The Item() method gets the event giving its index, identifier/key or reference. The Schedule.Event(id) method returns the event based on its index or identifier/key (equivalent of this method).
Example
oSchedule.Events.Clear(), removes all events of the control
Clear
Item(id) → {null|Event}
The Item() method gets the event giving its index, identifier/key or reference. The Schedule.Event(id) method returns the event based on its index or identifier/key (equivalent of this method). The method returns null if the event is not found, or an object of Event type, if the events collection contains the giving id. The Remove() method removes an event from the collection giving its index, identifier/key or reference. The Clear() method removes all events of the control. The onaddevent event occurs once a new event has been added to the Events collection. The onremoveevent event occurs once an event has been removed from the Events collection.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
any | The id parameter could be any of the following:
|
Returns:
Returns null if the event is not found, or an object of Event type, if the events collection contains the giving id.
- Type
- null | Event
Example
The following statements are equivalents:
oSchedule.Events.Item(id), gets the event based on its index or identifier/key
oSchedule.Event(id), gets the event based on its index or identifier/key
where oSchedule is an object of Schedule type
Item
Remove(id)
The Remove() method removes an event from the collection. The onremoveevent event occurs once an event has been removed from the Events collection. The Clear() method removes all events of the control. The Remove() method is equivelent with Event.Remove() method, which removes the event itself from the collection. The Item() method gets the event giving its index, identifier/key or reference. The Schedule.Event(id) method returns the event based on its index or identifier/key (equivalent of this method).
Parameters:
| Name | Type | Description |
|---|---|---|
id |
any | The id parameter could be any of the following:
|
Example
The following statements are equivalents:
oSchedule.Events.Remove(id), removes the event based on its index or identifier/key
oSchedule.Event(id).Remove(), removes the event based on its index or identifier/key
where oSchedule is an object of Schedule type
Remove
RemoveRange(range) → {number}
The RemoveRange() method removes multiple-events at once. The onremoveevent event occurs once an event has been removed from the Events collection. The Clear() method removes all events of the control. The Remove() method removes an event giving its index, identifier/key or reference. The Item() method gets the event giving its index, identifier/key or reference. The Schedule.Event(id) method returns the event based on its index or identifier/key (equivalent of this method).
Parameters:
| Name | Type | Description |
|---|---|---|
range |
any | Indicates an event, an array [{Event}], or an exontrol.Arr([{Event}]). |
Returns:
Returns the number of events being deleted
- Type
- number
Example
oSchedule.Events.RemoveRange(oSchedule.Event(0)), removes the first event of the control
oSchedule.Events.RemoveRange([oSchedule.Event(0), oSchedule.Event(1)]), removes the first two events of the control
RemoveRange