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.
Unfortunately, activation email could not send to your email. Please try again.

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

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.

 

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.

 

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

 

Article ID: Published Date: Last Revised Date: Platform: Control:
7899 07/31/2017 07/31/2017 JavaScript ejSchedule
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.