v7.3.0

EventSorter

This class contains static methods to sort events into appropriate display order within a day for all Calendar view contexts. It provides two sorting strategies: a default sorter that orders events by start date and then by duration (longest first), and an inter-day sorter used by MonthView that additionally prioritizes multi-day (inter-day) events above intra-day events to ensure they render as continuous bars across day cells.

Whenever a day's events are rendered, those events are sorted with defaultSorterFn method.

To use a custom event sort order in a Calendar view, configure the view's eventSorter:

const calendar = new Calendar({
    modes : {
        month : {
            // Custom sort: prioritize by event name after the default sort
            eventSorter(event1, event2) {
                return EventSorter.defaultSorterFn(event1, event2) || event1.name.localeCompare(event2.name);
            }
        }
    }
});

See also

  • MonthView — Uses the inter-day sorter for mixed event display
  • CalendarMixin — Views accept an eventSorter config
No results

Functions

Functions are methods available for calling on the class

    Source path

    Calendar/util/EventSorter.js

    Contents