DayPilot.Scheduler.sortDirections

The sortDirections property (string[]) holds the sort direction strings ("asc", "desc") used for items in the DayPilot.Event.data.sort array of concurrent events displayed by the JavaScript Scheduler component.

Declaration

DayPilot.Scheduler.sortDirections

Default Value

not set

Notes

  • The sort array values are arbitrary. In the example below, the first item stores an event type and the second item stores a creation date.

  • Event sorting is activated by specifying the sortDirections property.

  • It is only applied to concurrent events that overlap at least partially.

  • The first direction is applied to the first sort field, the second direction to the second field, and so on. Use "asc" for ascending order and "desc" for descending order.

Examples

JavaScript

The Scheduler events will be compared using the first field in ascending order and, if this value is equal, the second field in descending order.

const dp = new DayPilot.Scheduler("dp", {
  sortDirections: ["asc", "desc"],
  events: [
    {
      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"],
    },
  ],
  // ...
});
dp.init();

In this example, "Event 2" will be displayed as the first item.

Angular

<daypilot-scheduler [config]="config"></daypilot-scheduler>
config: DayPilot.SchedulerConfig = {
  sortDirections: ["asc", "desc"],
  // ...
};

React

<DayPilotScheduler
  sortDirections={["asc", "desc"]}
  {/* ... */}
/>

Vue

<DayPilotScheduler
  :sortDirections='["asc", "desc"]'
  <!-- ... -->
/>

See Also

Event Sorting [doc.daypilot.org]

DayPilot.Event.data

DayPilot.Scheduler Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript