We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

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:
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.

            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

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 () { 
        create: "onChange", 
function onChange(args) { 
    var recurrenceObj = $("#RecurrenceEditor").data("ejRecurrenceEditor"); 

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");

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. 

Live Chat Icon For mobile
Up arrow icon