Skip to main content

edit-event

Description

Fires when editing an event

Usage

"edit-event": ({
id?: string | number,
add?: boolean
}) => 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) enables/disables an ability to add 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" });

2) open the editor for the new event

// open the editor for the new event
calendar.api.exec("edit-event", { add: true });

3) 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);
});