The Scheduler component supports custom sorting of overlapping events (inside rows).
The default sorting rule corresponds to:
start asc, end desc
See also Exact Event Position.
JavaScript
The JavaScript Scheduler uses values from the sort
property of DayPilot.Event.data. The events will be sorted in the order specified using sortDirections property.
It can be enabled by specifying the sort directions in sortDirections
.
<div id="scheduler"></div>
<script>
const scheduler = new DayPilot.Scheduler("scheduler", {
sortDirections: ["asc", "desc"],
// ...
});
scheduler.init();
const events = [
{
start: "2033-03-25T00:00:00",
end: "2033-03-25T12:00:00",
id: "123",
resource: "A",
text: "Event 123",
sort: [1, "Event 123"]
},
{
start: "2033-03-25T00:00:00",
end: "2033-03-25T12:00:00",
id: "124",
resource: "A",
text: "Event 124",
sort: [2, "Event 124"]
}
];
scheduler.update({events});
</script>
Tutorial
ASP.NET WebForms
You can specify a custom sorting expression using EventSortExpression
property.
Example:
EventSortExpression="priority asc, name desc"
Note that the priority
and name
fields must be available in the data source.
ASP.NET MVC
Use EventSortExpression
to override the default sorting rule for concurrent events.
You can use custom database fields in the sort expression.
Example
EventSortExpression = "priority asc, name desc";