Hi,
I'm using the Kendo UI Gantt Chart using the declaration from the basic usage on the demo page : http://demos.telerik.com/kendo-ui/gantt/index
My Declaration is pretty much a copy and paste from the site with a variation to an end-point that is serving static data, and the ID's have been changed to string to support GUID IDs:
<script src="~/Content/kendoui/js/kendo.all.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="~/Content/kendoui/styles/kendo.common.min.css"/>
<link rel="stylesheet" href="~/Content/kendoui/styles/kendo.default.min.css" />
<link rel="stylesheet" href="~/Content/kendoui/styles/kendo.dataviz.min.css" />
<link rel="stylesheet" href="~/Content/kendoui/styles/kendo.dataviz.default.min.css" />
<script>
$(function () {
var serviceRoot = "https://localhost:44301";
var tasksDataSource = new kendo.data.GanttDataSource({
batch: false,
transport: {
read: {
url: serviceRoot + "/Project/Tasks?ID=@Model.ID",
dataType: "jsonp"
},
update: {
url: serviceRoot + "/Project/UpdateTasks?ID=@Model.ID",
dataType: "jsonp"
},
destroy: {
url: serviceRoot + "/Project/DestroyTask?ID=@Model.ID",
dataType: "jsonp"
},
create: {
url: serviceRoot + "/Project/CreateTask?ID=@Model.ID",
dataType: "jsonp"
},
parameterMap: function (options, operation) {
if (operation !== "read") {
return { models: kendo.stringify(options.models || [options]) };
}
}
},
schema: {
model: {
id: "id",
fields: {
id: { from: "ID", type: "string" },
orderId: { from: "OrderID", type: "number", validation: { required: true } },
parentId: { from: "ParentID", type: "string", defaultValue: null, validation: { required: true } },
start: { from: "Start", type: "date" },
end: { from: "End", type: "date" },
title: { from: "Title", defaultValue: "", type: "string" },
percentComplete: { from: "PercentComplete", type: "number" },
summary: { from: "Summary", type: "boolean" },
expanded: { from: "Expanded", type: "boolean", defaultValue: true }
}
}
}
});
var dependenciesDataSource = new kendo.data.GanttDependencyDataSource({
transport: {
read: {
url: serviceRoot + "/Project/Dependencies?ID=@Model.ID",
dataType: "jsonp"
},
update: {
url: serviceRoot + "/Project/UpdateDependencies?ID=@Model.ID",
dataType: "jsonp"
},
destroy: {
url: serviceRoot + "/Project/DestroyDependencies?ID=@Model.ID",
dataType: "jsonp"
},
create: {
url: serviceRoot + "/Project/CreateDependency?ID=@Model.ID",
dataType: "jsonp"
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
}
},
schema: {
model: {
id: "id",
fields: {
id: { from: "ID", type: "string" },
predecessorId: { from: "PredecessorID", type: "string" },
successorId: { from: "SuccessorID", type: "string" },
type: { from: "Type", type: "number" }
}
}
}
});
var gantt = $("#gantt").kendoGantt({
dataSource: tasksDataSource,
dependencies: dependenciesDataSource,
views: [
"day",
{ type: "week", selected: true },
"month"
],
columns: [
{ field: "id", title: "ID", width: 60 },
{ field: "title", title: "Title", editable: true, sortable: true },
{ field: "start", title: "Start Time", format: "{0:dd/MM/yyyy}", width: 100, editable: true, sortable: true },
{ field: "end", title: "End Time", format: "{0:dd/MM/yyyy}", width: 100, editable: true, sortable: true }
],
height: 700,
showWorkHours: false,
showWorkDays: false,
snap: false
}).data("kendoGantt");
$(document).bind("kendo:skinChange", function () {
gantt.refresh();
});
});
</script>
My end point is returning :
Tasks:
{"Data":[],"Total":0,"AggregateResults":null,"Errors":null}
Dependency:
{"Data":[],"Total":0,"AggregateResults":null,"Errors":null}
Its currently not returning anything since it is empty.
However, I'm receiving "Uncaught TypeError: Cannot read property 'start' of undefined" on line 52 on kendo.all.min.js:52. I'm not sure what the error is, would you be able to please able to assist ?