Initializing ejRecurrenceEditor based on existing recurrence rule
I have the recurrence rule for the recurring appointments stored in a db, and I want the user to be able to edit the rule at a later date through the ejRecurrenceEditor.
The appointments are opened in a custom modal window when editing them in the Schedule.My question is, how do you set the initial values of all the components in the ejRecurrenceEditor?
I want to be able to initialize the ejRecurrenceEditor based on simple and complex recurrence rules such as:
- FREQ=WEEKLY;INTERVAL=2;BYDAY=MO
- FREQ=YEARLY;BYDAY=FR;BYMONTH=5;BYSETPOS=3;INTERVAL=2;COUNT=10
In the following code snippet I would like to be able to 'apply' my recurrence rule to the recurrence editor, either when initilizing the ejRecurrenceEditor or when the create event is called.
$("#RecurrenceEditor").ejRecurrenceEditor({
startDate: new Date(startDate),
frequencies: ["daily", "weekly", "monthly", "yearly", "everyweekday"],
selectedRecurrenceType: 0,
locale: "da-DK",
dateFormat: "yyyy-MM-dd",
create: function (args) {
var ruleFromDB = "FREQ=WEEKLY;INTERVAL=2;BYDAY=MO";
// set component based on above rule
}
});
SIGN IN To post a reply.
4 Replies
KK
Karthigeyan Krishnamurthi
Syncfusion Team
May 13, 2019 07:25 AM UTC
Hi Toke,
Greetings from Syncfusion.
Kindly use the below code example to achieve your requirement.
|
$(function () {
$("#RecurrenceEditor").ejRecurrenceEditor({
create: "onChange",
});
});
function onChange(args) {
var recurrenceObj = $("#RecurrenceEditor").data("ejRecurrenceEditor");
var recurrenceRule = "FREQ=YEARLY;BYDAY=FR;BYMONTH=5;BYSETPOS=3;INTERVAL=2;COUNT=10";
recurrenceObj.recurrenceRuleSplit(recurrenceRule);
recurrenceObj.showRecurrenceSummary();
} |
Regards,
Karthi
TW
Toke Wivelsted
May 13, 2019 10:22 AM UTC
That was easier than expected, thank you for the swift response.
TW
Toke Wivelsted
May 13, 2019 01:09 PM UTC
Worth noting (for anyone reading this at a later date) that the recurrence rule may not be an empty string. The following lines will result in a difficult to decipher error.
var recurrenceRule = "";
var recObj = $("#RecurrenceEditor").data("ejRecurrenceEditor");
recObj.recurrenceRuleSplit(recurrenceRule);
recObj.showRecurrenceSummary();
KK
Karthigeyan Krishnamurthi
Syncfusion Team
May 14, 2019 04:13 AM UTC
HI Toke.
We are happy that our solution fulfilled your requirement.
Assigning empty recurrence rule will render the recurrence editor like below.
Regards,
Karthi
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
TW Toke Wivelsted
- May 12, 2019 01:10 PM UTC
- May 14, 2019 04:13 AM UTC