schema Object
The schema configuration of the GanttDataSource.
schema.model Object
The model configuration of the GanttDataSource. See GanttTask for more information.
Note that if the parentId
type is number
, its defaultValue
should be set to null
.
Example - configure the data source model schema
<script>
var dataSource = new kendo.data.GanttDataSource({
transport: {
read: {
url: "https://demos.telerik.com/kendo-ui/service/GanttTasks",
dataType: "jsonp"
},
update: {
url: "https://demos.telerik.com/kendo-ui/service/GanttTasks/Update",
dataType: "jsonp"
},
destroy: {
url: "https://demos.telerik.com/kendo-ui/service/GanttTasks/Destroy",
dataType: "jsonp"
},
create: {
url: "https://demos.telerik.com/kendo-ui/service/GanttTasks/Create",
dataType: "jsonp"
}
},
schema: {
model: {
id: "id",
fields: {
id: { from: "ID", type: "number" },
orderId: { from: "OrderID", type: "number", validation: { required: true } },
parentId: { from: "ParentID", type: "number", nullable: 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" },
expanded: { from: "Expanded" }
}
}
}
});
dataSource.fetch(function() {
var task = this.at(0);
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(task.title);
});
</script>