DayPilot.Scheduler.events.add

The events.add() method adds a new event to the JavaScript Scheduler component and renders it. Multiple subsequent calls when adding several events will be merged into a single UI update automatically.

Declaration

DayPilot.Scheduler.events.add(e, data);

Parameters

  • e (DayPilot.Event) - event to be created (it can be either a DayPilot.Event object or a raw data object)

  • data (object) - custom data to be sent to the server side with the Notify event (ASP.NET WebForms, ASP.NET MVC, Java)

Return Value

DayPilot.Action object that stores the action details.

Example

Create a new event using a DayPilot.Event object:

const e = new DayPilot.Event({
  start: new DayPilot.Date(), 
  end: new DayPilot.Date().addHours(5), 
  id: DayPilot.guid(), 
  text: "New Event", 
  resource: "E"
});
dp.events.add(e);

Create a new event using a raw data object:

dp.events.add({
  start: new DayPilot.Date(), 
  end: new DayPilot.Date().addHours(5), 
  id: DayPilot.guid(), 
  text: "New Event", 
  resource: "E"
});

See Also