The sortDirections property holds an array of sort direction strings ("asc" | "desc"). The JavaScript Scheduler component uses this array to determine the sorting direction of values specified in DayPilot.Event.data.sort array.
The sample events will be sorted using value specified in the sort array. The sort array values are arbitrary - in this case the first value holds an event type, the second value holds a creation date. The event sorting is activated by specifying the sortDirections property. It is only applied to concurrent events (they must overlap, at least partially).
The Scheduler events will be compared using the first field in ascending order and if this value is equal they will be compared using the second value in descending order.
dp.sortDirections = ["asc", "desc"]; dp.events.list = [ { id: 1, text: "Event 1", start: "2016-01-01", end: "2016-01-02", resource: "A", sort: [ "type1", "2016-01-01T:12:30" ]}, { id: 2, text: "Event 2", start: "2016-01-01", end: "2016-01-02", resource: "A", sort: [ "type1", "2016-01-01T:12:32" ]} ];
In this example, "Event 2" will be displayed as the first item.