Search
Recurrences

Schedule items can recur in time, following a specific recurrence pattern. For example an event could be set to occur each Monday, on the third day of each month, and so on. Associate a Recurrence object with an Item instance to specify the time period, pattern, and other properties for the repetition of that item in time. Use for this the Item.recurrence property.

The following code creates a recurrence with yearly recurrence pattern for a schedule Item:

JavaScript  Copy Code

var p = MindFusion.Scheduling;

// setup the recurrence
var recurrence = new p.Recurrence();
recurrence.pattern = p.RecurrencePattern.Yearly;
recurrence.yearly = p.YearlyRecurrence.SpecificDate;
recurrence.startDate = date;
recurrence.recurrenceEnd = p.RecurrenceEnd.Never;
item.recurrence = recurrence;

Once a recurrent item is created in a Calendar instance, the calendar creates multiple occurrences of this Item in the time period being visualized. Occasionally you will get references to these occurrences passed as arguments to the calendar events or returned by the calendar methods. Occurrences are instances of the same class as of the item that was set recurrent, however the value of their recurrenceState property is set to RecurrenceState.Occurrence. If a user modifies a recurrent event's occurrence in the calendar, an exception is created and the value of recurrenceState is now RecurrenceState.Exception. Recurrence Exceptions contain data about these item instances whose recurrence state is set to Exception and can be retrieved through the Recurrence.getExceptions function.

Recurrence Master

When a recurrence pattern is associated with an existing item, the item is said to become the master of the Recurrence. Every time the occurrences of a master item must be displayed in a given time range, they are generated by instantiating new objects of the same type as that of the master. This is necessary in order to support infinite recurrences, where the generation of all recurrence instances is not possible. When the occurrences are generated, their properties are copied from the master item. This is done automatically for the built-in item properties. The recurrence master can be retrieved via the Recurrence.master property. The Item that is master also has its recurrenceState set to RecurrenceState.Master.