DayPilot.Calendar.events.add

Declaration

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

Parameters

  • e (DayPilot.Event) - event to be created
  • 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. For use with versions with integrated server-side backend (ASP.NET WebForms, ASP.NET MVC, Java).

Example (JavaScript)

Create a new event:

var 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);

Example (ASP.NET WebForms)

Create a new event and save it in the queue.

var 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();

Create a new event and send a notification to the server immediately.

var 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();