Kendo TreeView making request on expand but not showing returned data

529 views Asked by At

I have a Kendo TreeView control that will load the first level of nodes, but when I attempt to expand one the expand triangle disappears. I can see that the ajax call is being made and returning valid Json as noted below, any ideas?

Here's the TreeView setup,

this.dataSource = new kendo.data.HierarchicalDataSource({
    transport: {
        read: {
            url: "...",
            dataType: 'json'
        }
    },
});

this.treeview = $(this.settings.selector).kendoTreeView({
    dataSource: this.dataSource,
}).data("kendoTreeView");

And the Initial returned Json,

[{"id":"00000000-0000-0000-0000-000000000000","text":"Root Node","hasChildren":true,"spriteCssClass":"folder"}]

And finally the Json returned on node expansion,

[{"id":"8295b0c3-8f85-4c2d-8fc6-fe43be8a734b","text":"Folder A","hasChildren":false,"spriteCssClass":"folder"}]
1

There are 1 answers

0
scmccart On

Ok, so it started to work after renaming the properties on my model to not be the same as the defaults for the datasource. I had to rename id, hasChildren, and text.

My TreeView setup ended up as,

this.dataSource = new kendo.data.HierarchicalDataSource({
    transport: {
        read: {
            url: "...",
            dataType: 'json'
        }
    },
    schema: {
        model: {
            id: "itemId",
            hasChildren: "isExpandable"
        }
    }
});

this.treeview = $(this.settings.selector).kendoTreeView({
    dataSource: this.dataSource,
    dataTextField: 'name'
}).data("kendoTreeView");