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.
Syncfusion Feedback

appointment placement

Thread ID:

Created:

Updated:

Platform:

Replies:

131543 Jul 16,2017 12:20 AM UTC Jul 17,2017 09:23 AM UTC JavaScript 1
loading
Tags: ejSchedule
David Barrett
Asked On July 16, 2017 12:20 AM UTC

On a schedule without timescale, is there any way to force the system to place the items in a particular order? 

I can hand the schedule an array in the order I would like it displayed on the calendar but the system does not seem to pay any attention to the order I give it. I don't know if there is an option or a setting that allows me to control the order they are placed so that I can place them in alphabetical or some other order based on a given value or set.

For example if you have two items that have the same date/time for the same resource, each time you refresh the calendar they can flip flop with each other so that there is no given way to organize them on the page. This is especially hard for when appointments span over the weekend and you switch the page and now they are no longer in the same order and it makes it hard to follow.

Any help would be appreciated 

Karthigeyan Krishnamurthi [Syncfusion]
Replied On July 17, 2017 09:23 AM UTC

Hi David, 
 
Thank you for contacting Syncfusion support. 
 
When two or more appointments are created with the same duration, the appointments are sorted based on the appointment’s Guid internally before rendering, since Guid of the appointments are unique and random, appointments will be sorted randomly which is the cause for the issue. We have prepared the sample to sort the same duration appointments based on its Subject which can be viewed from the below link. 
 
<Code> 
ej.Schedule.prototype._appointmentSort = function (appointments) { // here internal sorting function is overridden 
    var proxy = this; 
    if (this.currentView() == "agenda") { 
        appointments.sort(function (a, b) { 
            var d1 = a[proxy._appointmentSettings["startTime"]]; 
            var d2 = b[proxy._appointmentSettings["startTime"]]; 
            var d3 = a[proxy._appointmentSettings["endTime"]]; 
            var d4 = b[proxy._appointmentSettings["endTime"]]; 
            return d1.getTime() - d2.getTime() || d3.getTime() - d4.getTime(); 
        }); 
    } 
    else if (this.currentView() != "day") { 
        appointments.sort(function (a, b) { 
            var d1 = a[proxy._appointmentSettings["endTime"]] - a[proxy._appointmentSettings["startTime"]]; 
            var d2 = b[proxy._appointmentSettings["endTime"]] - b[proxy._appointmentSettings["startTime"]]; 
            var date1 = new Date(a[proxy._appointmentSettings["startTime"]]); 
            var date2 = new Date(b[proxy._appointmentSettings["startTime"]]); 
            var date3 = new Date(a[proxy._appointmentSettings["endTime"]]); 
            var date4 = new Date(b[proxy._appointmentSettings["endTime"]]); 
            var d3 = a[proxy._appointmentSettings["startTime"]]; 
            var d4 = b[proxy._appointmentSettings["startTime"]]; 
            if (date1 == date2 && date3 == date4) 
                return d3 - d4 || a.Subject.localeCompare(b.Subject); 
            else if (date1 - date2 == 0) 
                return d2 - d1 || d3 - d4 || a.Subject.localeCompare(b.Subject); 
            else 
                return d3 - d4 || a.Subject.localeCompare(b.Subject); 
        }); 
    } 
    else { 
        appointments.sort(function (a, b) { 
            var d3 = a[proxy._appointmentSettings["startTime"]]; 
            var d4 = b[proxy._appointmentSettings["startTime"]]; 
            var d1 = a[proxy._appointmentSettings["endTime"]] - a[proxy._appointmentSettings["startTime"]]; 
            var d2 = b[proxy._appointmentSettings["endTime"]] - b[proxy._appointmentSettings["startTime"]]; 
            return d3 - d4 || d2 - d1 || a.Subject.localeCompare(b.Subject); 
        }); 
    } 
    return appointments; 
} 
</Code> 
 
Regards, 
Karthigeyan 
 
 



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.

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

;