DayPilot.Switcher.addTrigger

The addTrigger() method adds a view change trigger, such as a button, and links it to a specified DayPilot.Calendar or DayPilot.Month view.

Use this method as an alternative to adding an item to options.triggers in the DayPilot.Switcher Constructor.

Declaration

DayPilot.Switcher.addTrigger(trigger, view)

Parameters

  • trigger (string or HTMLElement) - trigger element or its DOM ID

  • view (DayPilot.Calendar or DayPilot.Month) - target calendar view

Example

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

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

const switcher = new DayPilot.Switcher({
  triggers: [
    { id: "buttonDay", view: day },
  ],
});

switcher.addTrigger("buttonMonth", month);

See Also

DayPilot.Switcher Constructor

DayPilot.Switcher Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript