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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Initializing ejRecurrenceEditor based on existing recurrence rule

Thread ID:

Created:

Updated:

Platform:

Replies:

144560 May 12,2019 01:10 PM UTC May 14,2019 04:13 AM UTC jQuery 4
loading
Tags: ejSchedule
Toke Wivelsted
Asked On May 12, 2019 01:10 PM UTC

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

Karthigeyan Krishnamurthi [Syncfusion]
Replied On 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 


Toke Wivelsted
Replied On May 13, 2019 10:22 AM UTC

That was easier than expected, thank you for the swift response.

Toke Wivelsted
Replied On 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();   
                

Karthigeyan Krishnamurthi [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon