Hi,
I have this error when trying to return data for a schedule: "Uncaught TypeError: Cannot read property 'StartTime' of undefined" in ej.web.all.min.js.
My controller action looks like this:
public JsonResult Batch(EditParams param)
{
var data = new List<ScheduleData>();
data.Add(new ScheduleData() { Subject = "Testing", StartTime = DateTime.Now, EndTime = DateTime.Now.AddDays(3), AllDay = true, Owner = 1 });
return Json(data.AsEnumerable(), JsonRequestBehavior.AllowGet);
The class ScheduleData looks like this:
public class ScheduleData
{
public int Id;
public string Subject;
public string Location;
public System.DateTime StartTime;
public System.DateTime EndTime;
public string Description;
public System.Nullable<int> Owner;
public System.Nullable<int> Priority;
public System.Nullable<byte> Recurrence;
public string Categorize;
public System.Nullable<bool> AllDay;
}
And the Schedule code is this:
@(Html.EJ().Schedule("Schedule1")
.Width("100%")
.Height("525px")
.CellWidth("40px")
.Orientation(Syncfusion.JavaScript.Orientation.Horizontal)
.ShowCurrentTimeIndicator(false)
.CurrentDate(DateTime.Now)
.Views(views)
//.AllowDragDrop(true)
//.ShowAllDayRow(true)
.Resources(res => { res.Field("OwnerId").Title("Owner").Name("Owners").AllowMultiple(true).ResourceSettings(flds => flds.Datasource((IEnumerable<object>)ViewBag.Owners).Text("text").Id("id").Color("color")).Add(); })
.Group(gr => { gr.Resources(ViewBag.Resources); })
//.AppointmentSettings(fields => fields.Datasource(ViewBag.datasource)
.AppointmentSettings(fields => fields.Datasource(ds => ds.URL("/Projects/GetData").CrudURL("/Projects/Batch"))
.Id("Id")
.Subject("Subject")
.StartTime("StartTime")
.EndTime("EndTime")
.Description("Description")
.AllDay("true")
.Recurrence("Recurrence")
.RecurrenceRule("RecurrenceRule"))
)
The error comes after I try to insert a new appoitment, so after the return from the Batch action.
Thank you!