DayPilot.Month.onEventClick

The onEventClick event handler fires when the user clicks an event in the monthly calendar, before the default action configured by DayPilot.Month.eventClickHandling is performed.

Declaration

DayPilot.Month.onEventClick(args)

Parameters

  • args.control - Month control instance

  • args.e (DayPilot.Event) - clicked event reference

  • args.div - event <div> element

  • args.ctrl (boolean) - Ctrl key status

  • args.meta (boolean) - Meta key status

  • args.originalEvent - original browser click event

  • args.preventDefault() - cancels the default action

Notes

In legacy api=1 mode, the signature is onEventClick(e). Use DayPilot.Month.onEventClicked when you need to react after the default click action has finished.

Examples

JavaScript

const month = new DayPilot.Month("dp", {
  onEventClick: (args) => {
    if (args.e.id() === "3") {
      args.preventDefault();
    }
  },
  // ...
});
month.init();

Angular

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

React

<DayPilotMonth
  onEventClick={onEventClick}
  {/* ... */}
/>
const onEventClick = (args) => {
  if (args.e.id() === "3") {
    args.preventDefault();
  }
};

Vue

<DayPilotMonth
  @eventClick="onEventClick"
  <!-- ... -->
/>
const onEventClick = (args) => {
  if (args.e.id() === "3") {
    args.preventDefault();
  }
};

See Also

DayPilot.Month.onEventClicked

DayPilot.Month.eventClickHandling

DayPilot.Month Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript