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 are merged into a single UI update automatically.

Declaration

DayPilot.Scheduler.events.add(e[, data])

Parameters

  • e (DayPilot.Event | DayPilot.Event.data) - event to be created; you can pass either a DayPilot.Event instance or a raw event 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

Returns a DayPilot.Action object that stores the action details.

Notes

You can use either a DayPilot.Event object or a raw DayPilot.Event.data object when creating the event.

When you provide the optional data parameter, it is sent to the server with the Notify event in ASP.NET WebForms, ASP.NET MVC, and Java versions.

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

DayPilot.Scheduler.events.find()

Client-Side Event API [doc.daypilot.org]

Event Loading [doc.daypilot.org]

DayPilot.Scheduler Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript