Release date: November 26, 2014 (build 7.9.8349)
import org.daypilot.recurrence.RecurrenceRule; String id = "123"; // id of the master event DateTime start = new DateTime("2014-11-26T10:00:00"); // start of the master event RecurrenceRule rule = RecurrenceRule.fromDateTime(id, start).daily().indefinitely(); String recurrence = rule.encode();
This string should be stored in the database in a special VARCHAR field (e.g. "event_recurrence").
Specify the data source field with recurrence data using setDataRecurrenceField():
setDataResourceField("event_resource"); setDataIdField("event_id"); setDataTextField("event_name"); setDataStartField("event_start"); setDataEndField("event_end"); setDataRecurrenceField("event_recurrence");
Create a new database record and store the following recurrence string in the recurrence field:
String masterId = "123"; // id of the master event DateTime start = new DateTime("2014-11-27T10:00:00"); String recurrence = RecurrenceRule.encodeExceptionModified(masterId, start);
Create a new database record and store the following recurrence string in the recurrence field:
String masterId = "123"; // id of the master event DateTime start = new DateTime("2014-11-27T10:00:00"); String recurrence = RecurrenceRule.encodeExceptionModified(masterId, start);
The values from the regular fields (start, end, text, etc.) will be used for this occurrence.
You can build the recurrence rule manually instead of using the built-in recurrence rule encoding mechanism.
public void onBeforeEventRecurrence(BeforeEventRecurrenceArgs a) { Event e = a.getEvent(); Object source = e.getSource(); RecurrenceRule rule = ... a.setRule(rule); }
You can use RecurrenceExpander class to get a list of expanded occurrences. You need to supply the data source in the same format as used for DayPilotScheduler.events property:
RecurrenceExpander rex = new RecurrenceExpander(); rex.setDataResourceField("event_resource"); rex.setDataIdField("event_id"); rex.setDataTextField("event_name"); rex.setDataStartField("event_start"); rex.setDataEndField("event_end"); rex.setDataRecurrenceField("event_recurrence"); rex.setEvents(...); // Collection<?> DateTime rangeStart = new DateTime("2014-11-01T00:00:00"); // start of the result range DateTime rangeEnd = new DateTime("2014-11-30T00:00:00"); // end of the result range TimeSpan maxChange = TimeSpan.fromDays(14); // maximum allowed shift of the original occurrence modification (in backward direction) List<Event> result = rex.expand(rangeStart, rangeEnd, maxChange);
The supplied data source can include regular events.
It should include all records that have data in the recurrence field:
All event handlers (server-side and client-side) store information about event recurrence.
Server-side events:
Client-side events:
For the regular occurrences args.getId() will return null.
For exceptions (deleted and modified occurrences) args.getId() will return the exception record id.