DayPilot.Calendar.events.add

The events.add() method adds a new DayPilot.Event to the current Calendar on the client side.

Declaration

DayPilot.Calendar.events.add(e, data)

Parameters

  • e (DayPilot.Event) - item to create

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

Return Value

Returns a DayPilot.Action object that stores the action details in versions with an integrated server-side backend (ASP.NET WebForms, ASP.NET MVC, Java).

Notes

Use this method to create a single event without reloading the page.

In server-backed editions, the returned action lets you batch the change in the notify queue or send it to the server immediately.

Example

JavaScript

const e = new DayPilot.Event({
  start: "2019-09-01T12:00:00",
  end: "2019-09-01T14:00:00",
  id: DayPilot.guid(),
  text: "New Event"
});
dpc.events.add(e);

ASP.NET WebForms: queue the action

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

ASP.NET WebForms: notify the server immediately

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

See Also

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

Event Creation [doc.daypilot.org]

Notify Queue [doc.daypilot.org]

DayPilot.Calendar Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript