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.
DayPilot.Switcher.addTrigger(trigger, view)trigger (string or HTMLElement) - trigger element or its DOM ID
view (DayPilot.Calendar or DayPilot.Month) - target calendar view
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);