To add an event to the scheduler, you may use one of three methods:
The most recommended way is the addEvent method:
var eventId = scheduler.addEvent({
start_date: "16-06-2019 09:00",
end_date: "16-06-2019 12:00",
text: "Meeting",
holder: "John", // user data
room: "5" // user data
});
Related sample: Validating lightbox fields
Related sample: Default values for lightbox controls
There are two cases of updating events possible in Scheduler:
var eventId = scheduler.addEvent({
start_date: "16-06-2019 09:00",
end_date: "16-06-2019 12:00",
text: "Meeting"
});
var event = scheduler.getEvent(eventId);
event.text = "Conference"; //changes event's data
scheduler.updateEvent(event.id); // repaint without sending to the server
//or
scheduler.addEvent(event.id); // repaint and send update to the server
To delete an existing event from the scheduler, use the deleteEvent method:
scheduler.parse([
{id:1, start_date:"06/30/2009 09:00", end_date:"06/30/2009 12:00", text:"Task1"},
{id:2, start_date:"06/30/2009 12:00", end_date:"06/30/2009 20:00", text:"Task2"}
],"json");
...
scheduler.deleteEvent(2);
If you have dataProcessor initialized, added to/deleted from the scheduler events will be automatically added/deleted in the data source. See the detailed information in the Server-Side Integration guide.
Related sample: Fully custom lightbox
Back to top