Hi,
I have been working with the Scheduler and I can't make it to work.
I have an object that extends ISchedulerEvent with the start and end dates, apart from all the needed parameters:
public class BsScheduleMeeting : ISchedulerEvent
{
private DateTime start;
public DateTime Start
{
get
{
return start;
}
set
{
start = value.ToUniversalTime();
}
}
private DateTime end;
public DateTime End
{
get
{
return end;
}
set
{
end = value.ToUniversalTime();
}
}
}
With this we created a scheduler on a Razor view with a custom datasource, defining the model and the transport functionality (is only a read):
@(Html.Kendo().Scheduler<BsScheduleMeeting>()
.Name("scheduler")
.Date(DateTime.Now.Date)
.StartTime(DateTime.Now.Date.AddHours(7))
.EndTime(DateTime.Now.Date.AddHours(22))
.Editable(false)
.Height(700)
.Views(views =>
{
views.DayView(day => day.Selected(true));
})
.Timezone("Etc/UTC")
.DataSource(datasource => datasource
.Custom()
.Schema(schema => schema
.Model(m => {
m.Id(f => f.MeetingID);
m.Field("title", typeof(string)).DefaultValue("No title").From("title");
m.Field("start", typeof(DateTime)).From("start");
m.Field("end", typeof(DateTime)).From("end");
m.Field("description", typeof(string)).From("description");
m.Field("recurrenceID", typeof(int)).From("recurrenceID");
m.Field("recurrenceRule", typeof(string)).From("recurrenceRule");
m.Field("recurrenceException", typeof(string)).From("recurrenceException");
m.Field("isAllDay", typeof(bool)).From("isAllDay");
m.Field("startTimezone", typeof(string)).From("startTimezone");
m.Field("endTimezone", typeof(string)).From("endTimezone");
})
)
.ServerPaging(false)
.ServerFiltering(true)
.Transport(transport => transport
.Read(read =>
{
read.Action("GetJson", "BSSchedule");
})
)
)
)
The controller call that returns the data is the next one:
public virtual JsonResult GetJson([DataSourceRequest] DataSourceRequest request)
{
return Json(GetTasks().ToDataSourceResult(request));
}
private IList<BsScheduleMeeting> GetTasks()
{
IList<BsScheduleMeeting> schedulerTasks = new List<BsScheduleMeeting>()
{
new BsScheduleMeeting {
Description = "",
StartTimezone = "UTC",
MeetingID = 1,
Title = "AP Physics",
Start = new DateTime(2022,10,24,8,00,00),
End= new DateTime(2022,10,24,9,00,00),
EndTimezone = "UTC",
RecurrenceRule = null,
RecurrenceID = 1,
RecurrenceException = null,
IsAllDay = false
},
new BsScheduleMeeting {
Description = "",
StartTimezone = "UTC",
MeetingID = 2,
Title = "History",
Start = new DateTime(2022,10,24,9,00,00),
End= new DateTime(2022,10,24,10,00,00),
EndTimezone = "UTC",
RecurrenceRule = null,
RecurrenceID = 2,
RecurrenceException = null,
IsAllDay = false
},
new BsScheduleMeeting {
Description = "",
StartTimezone = "UTC",
MeetingID = 3,
Title = "Art",
Start = new DateTime(2021,10,24,9,00,00),
End= new DateTime(2022,10,24,10,00,00),
EndTimezone = "UTC",
RecurrenceRule = null,
RecurrenceID = 3,
RecurrenceException = null,
IsAllDay = false
},
};
return schedulerTasks.ToList();
}
With this, I tryed everything but couldn't make it work. The most common error that I get is this one on Javascript:
and the data is being returned correctly, as shown in the next image:
What can I do so the Scheduler gets the info that I send?
Thank you in advance,
Diego.