)
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.
Essential JS2

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

Syncfusion Feedback

How to retrieve all Recurrence instances, when "Ends Never" option is chosen?

Platform: jQuery |
Control: ejSchedule |
Published Date: July 31, 2017 |
Last Revised Date: May 28, 2019

When the Scheduler saves a recurrence appointment with “Ends Never” option chosen, it will usually generate and store the limited occurrences of that recurring appointment, for example one month before and after the current month. The following steps shows the way to retrieve all the instances of a recurring appointment on “Ends Never” option chosen (regardless of default limited period).

 

Step1: Create a Scheduler search sample by referring the below online sample link.

http://js.syncfusion.com/demos/web/#!/bootstrap/schedule/appointmentsearch

 

Step2: Override the public filterAppointments method to modify the default filtering method as shown below.

ej.Schedule.prototype.filterAppointments = function (filterConditions) {
    // here we are storing the default filtering range and current date in other variables
    var oldRenderStart = this._dateRender[0];
    var oldRenderEnd = this._dateRender[this._dateRender.length - 1];
    var oldDate = this.currentDate();
    // here we are assigning the new filtering range and current date
    var newRenderStart = new Date(filterConditions[0].value).getTime();
    this._dateRender[0] = newRenderStart;
    var newRenderEnd = new Date(filterConditions[1].value).getTime();
    this._dateRender[this._dateRender.length - 1] = newRenderEnd;
    this.currentDate(new Date(filterConditions[0].value));
    this._dataProcessing(this._currentAppointmentData);
    var result, queryManagar = ej.Query(), matchcaseVal;
    if (!ej.isNullOrUndefined(filterConditions)) {
        var firstFilterCondition = filterConditions[0];
        matchcaseVal = ej.isNullOrUndefined(firstFilterCondition.matchcase) ? true : firstFilterCondition.matchcase;
        var predicate = ej.Predicate(firstFilterCondition.field, firstFilterCondition.operator, firstFilterCondition.value, matchcaseVal);
        for (var i = 1; i < filterConditions.length; i++) {
            matchcaseVal = ej.isNullOrUndefined(filterConditions[i].matchcase) ? true : filterConditions[i].matchcase;
            predicate = predicate[filterConditions[i].predicate](filterConditions[i].field, filterConditions[i].operator, filterConditions[i].value, matchcaseVal);
        }
        queryManagar.where(predicate);
        if ((this.dataSource() instanceof ej.DataManager)) {
            result = queryManagar;
        }
        else
            result = ej.DataManager(this._processed).executeLocal(queryManagar);
    }
    // here we are again assigning the default filtering range and current date values
    this._dateRender[0] = oldRenderStart;
    this._dateRender[this._dateRender.length - 1] = oldRenderEnd;
    this.currentDate(new Date(oldDate));
    this._dataProcessing(this._currentAppointmentData);
    return result;
}

 

Sample: http://jsplayground.syncfusion.com/30ibbcmh

Step3: Run the above sample and the Scheduler will now be rendered with endless recurrence instances as shown below.

Scheduler with endless recurrence instances

 

Step4: Click the search icon and select the start range as June 5, 2017 9AM and end range as October 10, 2017 1PM as shown below.

Search appoinment window

 

Step5: When “Search” button is clicked, filtered recurrence instances from the month of June to October will be displayed as shown below.

Filtered recurrence instances

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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