Hi,
I can't seem to get the Scheduler datasource read operation to work.
Scheduler initialization:
self.scheduler = $('#scheduler').kendoScheduler({
views: ["day", { type: "week", selected: true }, "month", "agenda"],
culture: "nl-NL",
allDaySlot: false,
majorTick: 60,
minorTickCount: period.CustomersPerHour != 0 ? period.CustomersPerHour : 4,
date: new Date(period.From),
startTime: new Date("2013/6/6 08:00"),
endTime: new Date("2013/6/6 21:00"),
editable: {
template: $("#editor").html()
},
dataSource: {
batch: false,
transport: {
read: {
url: "/api/appointment",
dataType: "json"
},
update: {
url: "/api/appointment/update",
dataType: "json"
},
create: {
url: "/api/appointment/create/?periodId=" + period.Id + '&periodType=' + period.$type,
dataType: "json",
contentType: "application/json"
},
destroy: {
url: "/api/appointment/destroy",
dataType: "json"
},
},
schema: {
model: {
Id: "Id",
fields: {
Id: {
from: "Id",
type: "number"
},
Title: {
from: "Title",
defaultValue: "No title",
validation: {
required: true
}
},
Description: {
from: "Description"
},
Start: {
type: "date",
from: "Start"
},
End: {
type: "date",
from: "End"
},
IsAllDay: {
type: "boolean",
from: "IsAllDay"
}
}
}
}
},
}).data("kendoScheduler");
WebApi code (the WebApi is set to return JSON):
[HttpGet]
public IEnumerable<Appointment> Get()
{
return this.unitOfWork.Repository<Appointment>().Get;
}
WebApi response:
[{"$type":"Banden_Inn.Data.Entities.Models.Appointment, Banden-Inn.Data.Entities","Title":"Afspraak 1","Description":null,"Start":null,"End":null,"IsAllDay":false,"Id":1,"Created":"2013-08-02T13:58:33.853","Edited":null},{"$type":"Banden_Inn.Data.Entities.Models.Appointment, Banden-Inn.Data.Entities","Title":"Afspraak 2","Description":null,"Start":null,"End":null,"IsAllDay":false,"Id":2,"Created":"2013-08-02T13:58:33.857","Edited":null}]
Appointment entity (Base class contains id, created etc..):
public class Appointment : Base
{
public string Title { get; set; }
public string Description { get; set; }
public DateTime? Start { get; set; }
public DateTime? End { get; set; }
public bool IsAllDay { get; set; }
}
What am I doing wrong? I'm missing something, but can't seem to figure out what?!
Thanks in advance!
Kind regards,
Ruud Prinsen
I can't seem to get the Scheduler datasource read operation to work.
Scheduler initialization:
self.scheduler = $('#scheduler').kendoScheduler({
views: ["day", { type: "week", selected: true }, "month", "agenda"],
culture: "nl-NL",
allDaySlot: false,
majorTick: 60,
minorTickCount: period.CustomersPerHour != 0 ? period.CustomersPerHour : 4,
date: new Date(period.From),
startTime: new Date("2013/6/6 08:00"),
endTime: new Date("2013/6/6 21:00"),
editable: {
template: $("#editor").html()
},
dataSource: {
batch: false,
transport: {
read: {
url: "/api/appointment",
dataType: "json"
},
update: {
url: "/api/appointment/update",
dataType: "json"
},
create: {
url: "/api/appointment/create/?periodId=" + period.Id + '&periodType=' + period.$type,
dataType: "json",
contentType: "application/json"
},
destroy: {
url: "/api/appointment/destroy",
dataType: "json"
},
},
schema: {
model: {
Id: "Id",
fields: {
Id: {
from: "Id",
type: "number"
},
Title: {
from: "Title",
defaultValue: "No title",
validation: {
required: true
}
},
Description: {
from: "Description"
},
Start: {
type: "date",
from: "Start"
},
End: {
type: "date",
from: "End"
},
IsAllDay: {
type: "boolean",
from: "IsAllDay"
}
}
}
}
},
}).data("kendoScheduler");
WebApi code (the WebApi is set to return JSON):
[HttpGet]
public IEnumerable<Appointment> Get()
{
return this.unitOfWork.Repository<Appointment>().Get;
}
WebApi response:
[{"$type":"Banden_Inn.Data.Entities.Models.Appointment, Banden-Inn.Data.Entities","Title":"Afspraak 1","Description":null,"Start":null,"End":null,"IsAllDay":false,"Id":1,"Created":"2013-08-02T13:58:33.853","Edited":null},{"$type":"Banden_Inn.Data.Entities.Models.Appointment, Banden-Inn.Data.Entities","Title":"Afspraak 2","Description":null,"Start":null,"End":null,"IsAllDay":false,"Id":2,"Created":"2013-08-02T13:58:33.857","Edited":null}]
Appointment entity (Base class contains id, created etc..):
public class Appointment : Base
{
public string Title { get; set; }
public string Description { get; set; }
public DateTime? Start { get; set; }
public DateTime? End { get; set; }
public bool IsAllDay { get; set; }
}
What am I doing wrong? I'm missing something, but can't seem to figure out what?!
Thanks in advance!
Kind regards,
Ruud Prinsen