DayPilot.Switcher.onSelect

The onSelect event handler fires when the switcher changes the current calendar view.

Declaration

DayPilot.Switcher.onSelect(args)

Parameters

  • args.source (HTMLElement) - the trigger that was used to change the view (for example a button)

  • args.target (DayPilot.Calendar or DayPilot.Month) - the target view component

Example

const day = new DayPilot.Calendar("dpDay", {
  // ...
});
day.init();

const week = new DayPilot.Calendar("dpWeek", {
  // ...
});
week.init();

const month = new DayPilot.Month("dpMonth", {
  // ...
});
month.init();

const switcher = new DayPilot.Switcher({
  triggers: [
    { id: "buttonDay", view: day },
    { id: "buttonWeek", view: week },
    { id: "buttonMonth", view: month }
  ],
  onSelect: (args) => {
    console.log("Selected view:", args.target);
  }
});

switcher.select("buttonWeek");

See Also

DayPilot.Switcher.onChange

DayPilot.Switcher.onChanged

DayPilot.Switcher Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript