Reputation: 1362
I have following example (modified original demo from Kendo Scheduler):
In this example I create a data array with two events which are displayed properly on the scheduler view on the right side.
var data = [{ TaskID: 0, OwnerID: 1, Title: "Bowling tournament 6", Start: "2013-06-10T10:30:00", End: "2013-06-10T11:30:00", IsAllDay: false},{ TaskID: 1, OwnerID: 2, Title: "Golf", Start: "2013-06-11T10:30:00", End: "2013-06-11T11:30:00", IsAllDay: false}];
I have included a button, which event I catch and then extend this "data" array with one more element like this:
data.push({ TaskID: 2, OwnerID: 3, Title: "New Event", Start: "2013-06-12T10:30:00", End: "2013-06-12T11:30:00", IsAllDay: false});
console.log(data);
The console.log of the array confirms the addition. I hence call the following refresh code:
$("#scheduler").data("kendoScheduler").refresh();
...which does not update my scheduler view on the right to include the new event (created for wednesday 6/12).
I have also tried:
$('#scheduler').data('kendoScheduler').dataSource.read();
but this results in an error.
Any ideas?
Upvotes: 0
Views: 9114
Reputation: 1
One way to keep the scheduler updated, is by using a SchedulerDataSource, and the setDataSource method of the scheduler (https://docs.telerik.com/kendo-ui/api/javascript/ui/scheduler/methods/setdatasource).
var dataSource = new kendo.data.SchedulerDataSource({
data: data
});
$("#scheduler").data("kendoScheduler").setDataSource(dataSource);
Upvotes: 0
Reputation: 68
The recommended way to add an event to the Kendo Scheduler and have it re-render automatically is with the dataSource.add() method.
$("#scheduler").data("kendoScheduler").dataSource.add({your data});
https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/methods/add
Updated example here: http://dojo.telerik.com/ifeziLiJ
Upvotes: 0
Reputation: 21
The command to update the current view of the scheduler is :
var scheduler = $('#scheduler').data('kendoScheduler');
scheduler.view(scheduler.view().name);
Upvotes: 2