Overlapping events order

Ask for help related to our Calendar 2.x version
Post Reply
User avatar
kprokopenko
Posts: 1
Joined: Tue Jun 11, 2019 4:51 pm

Overlapping events order

Post by kprokopenko » Tue Jun 11, 2019 4:56 pm

Hi!

In case of overlapping events (that get stacked on the week view) I see that the order is determined by 1) Start time of the event and 2) Length of the event.

is it possible to change that based on the property of the event? For example, I have property called "status". If "status" is "approved", I want those events *always* be displayed first in case of overlap.

Thanks!
Awesome UI controls, by the way!

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 1702
Joined: Fri Apr 01, 2016 11:08 am

Re: Overlapping events order

Post by pmiklashevich » Thu Jun 13, 2019 11:43 am

Hello,

Calendar uses Cal.util.EventSorter.defaultSorterFn to sort overlapping events in Month view, Agenda view, and Year view (that list view when you click on a day with events). Day and Week view are basically vertical mode of Scheduler. Scheduler has public verticalEventSorterFn config. To pass it to these scheduler views you can configure Calendar like this:

Code: Select all

    modes : {
        day : {
            view : {
                verticalEventSorterFn : function () {}
            }
        },
        week : {
            view : {
                verticalEventSorterFn : function () {}
            }
        }
    },
Unfortunately there is no a single public config to sort the events in all modes. If you need to change sorting logic in calendar views, please override Cal.util.EventSorter.defaultSorterFn function.

Best,
Pavel
Pavel Miklashevich - Core Developer

Post Reply