DayPilot.Calendar.clearSelection

The clearSelection() method clears the current time range selection in the JavaScript Calendar component.

Declaration

DayPilot.Calendar.clearSelection()

Example

The typical usage is to clear the selection in DayPilot.Calendar.onTimeRangeSelected(args) after processing the selected range.

const dp = new DayPilot.Calendar("dp", {
  onTimeRangeSelected: async (args) => {
    const modal = await DayPilot.Modal.prompt("New event name:", "Event");
    dp.clearSelection();
    if (modal.canceled) {
      return;
    }
    dp.events.add({
      start: args.start,
      end: args.end,
      id: DayPilot.guid(),
      text: modal.result
    });
  },
  // ...
});
dp.init();

See Also

Time Range Selecting [doc.daypilot.org]

DayPilot.Calendar.onTimeRangeSelected

DayPilot.Calendar Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript