Skip to main content

edit-event

Description

Fires when editing an event

Usage

"edit-event": ({
id?: string | number,
add?: boolean | object
}) => void;

Parameters

The callback of the edit-event event can take an object with the following parameters:

  • id - (optional) an ID of the event to be edited
  • add - (optional) an ability to add new event. This parameter takes one of 2 available options:
    • true / false - enables/disables an ability to add new event
    • object - an object of new event

Depending on the passed parameters, you can perform the following operations:

  1. open the editor by the event ID
// create Event Calendar
const calendar = new eventCalendar.EventCalendar("#root", {
// configuration parameters
});
// open the editor for the event with the "1" ID
calendar.api.exec("edit-event", { id: "1" });
  1. open the editor for the new event
// open the editor for the new event
calendar.api.exec("edit-event", { add: true });

// open the editor for the new event with the initial data
calendar.api.exec("edit-event", {
add: {
id: "44",
type: "meeting",
start_date: new Date("2023-09-16T15:00:00"),
end_date: new Date("2023-09-16T16:00:00"),
text: "Custom event",
details: "Rome, Italy",
}
});
  1. close the editor
// close the editor 
calendar.api.exec("edit-event");
info

For handling the inner events of Event Calendar you can use the Event Bus methods

Example

// create Event Calendar
const calendar = new eventCalendar.EventCalendar("#root", {
// configuration parameters
});

// subscribe on the "edit-event" event
calendar.api.on("edit-event", (obj) => {
console.log(obj);
});