DayPilot.Month.onEventSelect

The onEventSelect handler fires before the monthly calendar applies an event selection change.

Declaration

DayPilot.Month.onEventSelect(args)

Parameters

  • args.e (DayPilot.Event) - affected item

  • args.selected (boolean) - current selection state before the change

  • args.ctrl (boolean) - Ctrl key state

  • args.preventDefault() - cancels the default selection change

Notes

Call args.preventDefault() when the selection change should be rejected.

In api=1 mode, the legacy signature is onEventSelect(e, change).

Examples

JavaScript

const month = new DayPilot.Month("dp", {
  onEventSelect: (args) => {
    if (args.e.data.locked) {
      args.preventDefault();
    }
  },
  // ...
});
month.init();

Angular

<daypilot-month [config]="config"></daypilot-month>
config: DayPilot.MonthConfig = {
  onEventSelect: (args) => {
    if (args.e.data.locked) {
      args.preventDefault();
    }
  },
  // ...
};

React

<DayPilotMonth
  onEventSelect={onEventSelect}
  {/* ... */}
/>
const onEventSelect = (args) => {
  if (args.e.data.locked) {
    args.preventDefault();
  }
};

Vue

<DayPilotMonth
  @eventSelect="onEventSelect"
  <!-- ... -->
/>
const onEventSelect = (args) => {
  if (args.e.data.locked) {
    args.preventDefault();
  }
};

See Also

DayPilot.Month Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript