I need some help using a hierarchicalDataSource with a treeview control. It works fine as an array but I can't figure out how to make it work with a datasource.
Essentially my datasource is a two level structure.
date:
eventId:
Here are two different datasources in my app.js file.
window.calendarData = new kendo.data.HierarchicalDataSource({
transport: {
read: {
url: "https://...",
dataType: "json"
}
},
schema: {
model: {
id: "eventId",
hasChildren: "items",
fields: {
eventId: {
editable: false
},
date: {
editable: true
},
items: {
model: {
id: "eventId",
fields: {
eventId: {
editable:false
},
lastname: {
type: "string",
editable: true
}
}
}
}
}
}
}
});
window.calendarDataLocal = new kendo.data.HierarchicalDataSource({
data: [
{
eventId: 0,
date: '2015-08-01',
items: [
{
eventId: 1,
lastname: "poulin",
},
{
eventId: 2,
lastname: "smith",
}
]
},
{
eventId: 3,
date: '2015-08-02',
items: [
{
eventId: 4,
lastname: "jones"
}
]
}
]
});
Here is the control I'm putting it into.
<div id="mainCalendar">
</div>
<script>
$(document).ready(function () {
$("#mainCalendar").kendoTreeView({
dataSource: window.calendarData,
dataTextField: ["date", "lastname"]
})
});
</script>
If I use window.calendarDataLocal, it works, the other way what happens is the two main nodes (identified by date) show up but the lower level items show up as undefined.
Essentially my data is made up