Dear,
I am doing a booking system with Kendo UI Scheduler,Everything working without resource if I resources not bind and not working.getting error like
"Uncaught TypeError: Cannot read property 'length' of undefined"
[EnableQuery]public IQueryable<NeedScheduler> Get()
{
return (from cn in Context.CorporateNeeds
select new NeedScheduler()
{
NeedId = cn.NeedId,
ObjectTypeId = cn.ObjectTypeId,
EquipmentId = cn.EquipmentId,
ProjectId = cn.ProjectId,
ProjectName = cn.ProjectName,
NeedDescription = cn.NeedDescription,
PlanningGroupDescription = cn.PlanningGroupDescription,
DistrictDescription = cn.DistrictDescription,
ProjectedStartDate = cn.ProjectedStartDate,
ProjectedEndDate = cn.ProjectedEndDate,
MatchStatus = cn.MatchStatus,
Comments = cn.Comments,
EquipmentRequirementId = cn.EquipmentRequirementId,
FromPES = cn.FromPES,
RegionDescription = "test",
Attendees = Context.CorporateNeeds.Take(3).Where(s => s.ObjectTypeId == cn.ObjectTypeId).Select(m => m.EquipmentId).ToList(),
IsAllDay=false
});
}
and My scheduler datasource is:
$("#scheduler").kendoScheduler({
date: new Date(), //start date. set to today or whichever date the scheduler should land on
dateHeaderTemplate: kendo.template("<strong>#=kendo.toString(date, 'd/M')#</strong>"),
resources: resourcesObjects,
snap: false,
timezone: "Etc/UTC",
views: [
"timelineWeek",
{
type: "timelineMonth",
startTime: new Date("2013/6/13 00:00 AM"),
majorTick: 1440,
selected: true
},
"timelineYear"
//we can add any other view from the available views or a custom view.
],
allDaySlot: true,
eventHeight: 40,
height: 600,
dataSource: {
type: "odata-v4",
transport: {
read: {
url: servicUrl + "NeedSchedulers?&token=" + token,
dataType: "json",
contentType: "application/json; charset=utf-8",
},
update: {
url: function (data) {
return servicUrl + "NeedSchedulers('" + data.NeedId + "')?&token=" + token;
},
type: "PUT",
dataType: "json",
contentType: "application/json; charset=utf-8",
data: function (response) {
return response;
},
},
create: {
url: servicUrl + "NeedSchedulers?&token=" + token,
type: "Post",
dataType: "json",
contentType: "application/json; charset=utf-8",
data: function (response) {
return response;
},
},
destroy: {
url: function (data) {
return servicUrl + "NeedSchedulers('" + data.NeedId + "')?&token=" + token;
},
type: "DELETE",
dataType: "json",
contentType: "application/json; charset=utf-8",
},
parameterMap: function (data, operation) {
return JSON.stringify(data);
}
},
schema: {
data: function (data) {
return data.value;
},
total: function (data) {
return parseInt(data["odata.count"]);
},
model: {
id: "NeedId",
fields: {
NeedId: { from: "NeedId" },
ObjectTypeId: { from: "ObjectTypeId" },
EquipmentId: { from: "EquipmentId" },
ProjectId: { from: "ProjectId" },
title: { from: "ProjectName", nullable: true },
NeedDescription: { from: "NeedDescription" },
PlanningGroupDescription: { from: "PlanningGroupDescription" },
DistrictDescription: { from: "DistrictDescription" },
start: { type: "date", from: "ProjectedStartDate" },
end: { type: "date", from: "ProjectedEndDate" },
MatchStatus: { from: "MatchStatus", nullable: true },
Comments: { from: "Comments", nullable: true },
EquipmentRequirementId: { from: "EquipmentRequirementId", nullable: true },
RegionDescription: { from: "RegionDescription", nullable: true },
FromPES: { type: "boolean", from: "FromPES" },
isAllDay: { type: "boolean", from: "IsAllDay" },
Attendees: { type: "object" }
}
}
},
group: {
resources: ["Rooms", "Attendees"],
orientation: "vertical"
},
resources: [
{
field: "EquipmentId",
name: "EquipmentId",
dataSource: [
{ text: "Meeting Room 101", value: "10002", color: "#6eb3fa" },
{ text: "Meeting Room 201", value: "10001", color: "#f58a8a" }
],
title: "EquipmentId"
},
{
field: "Attendees",
name: "Attendees",
dataSource: [
{ text: "Alex", value: "10002", color: "#f8a398" },
{ text: "Bob", value: "10001", color: "#51a0ed" },
{ text: "Charlie", value: "10010", color: "#56ca85" }
],
multiple: true,
title: "Attendees"
}
]
}
});
});