I am using a Kendo MVC Scheduler control with a TimeLine view and I am adding new events via an ajax call to my server to add to a table that holds scheduler events. I need a way to refresh the scheduler or to add an event manually just so it will show up until the next refresh. Is there an easy way to do that?
I tried the following but it doesn't call my read method:
var scheduler = $("#scheduler").data("kendoScheduler");
scheduler.resources[0].dataSource.read().then(
function () {
scheduler.view(scheduler.view().name);
});
This is my client side code:
<% Html.Kendo().Scheduler<WheresMyTool.Models.MeetingViewModel>()
.Name("scheduler")
.Date(new DateTime(2016, 12, 16))
.StartTime(new DateTime(2016, 12, 16, 7, 00, 00))
.MajorTick(60)
.EventTemplate(
"<div class='#= eventStyle #' title='#= description #'>" +
"#= title #" +
"</div>")
.Views(views =>
{
views.TimelineWeekView(timeline =>
{
timeline.EventHeight(25);
timeline.ColumnWidth(1);
});
views.TimelineView(timeline =>
{
timeline.EventHeight(25);
timeline.ColumnWidth(10);
});
views.TimelineMonthView(timeline =>
{
timeline.StartTime(new DateTime(2016, 12, 16, 00, 00, 00));
timeline.EndTime(new DateTime(2016, 12, 16, 00, 00, 00));
timeline.MajorTick(1440);
timeline.MinorTickCount(1);
timeline.EventHeight(25);
timeline.ColumnWidth(10);
});
})
.Editable(a => a.Confirmation(false))
.Timezone("Etc/UTC")
.Group(group => group.Resources("Attendees").Orientation(SchedulerGroupOrientation.Vertical))
.Events(e =>
{
e.DataBound("schedulerDataBound");
e.Edit("scheduler_edit");
e.Add("scheduler_add");
})
.Resources(resource =>
{
resource.Add(m => m.Attendees)
.Title("Attendees")
.Name("Attendees")
.Multiple(true)
.DataTextField("Text")
.DataValueField("Value")
.DataColorField("Color")
.BindTo(Model.resourceList);
})
.DataSource(d => d
.AutoSync(true)
.Read("SchedulerRead", "Scheduler")
.Create("SchedulerCreate", "Scheduler")
).Render();
%>