This is a migrated thread and some comments may be shown as answers.

Treeview Static Root Node

1 Answer 142 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 28 Feb 2013, 04:10 PM
I'm trying to create a tree with a static root node that has all children populated from an ASP.NET WebMethod.

I saw a similar example when I searched the forums, but I can't get it to work at all. Below is the code I'm testing with. Any help is appreciated. Thanks!

ds = new kendo.data.HierarchicalDataSource({
    data: [
            { FolderName: 'Documents', hasChildren: true, expanded: true }
    ],
    schema: {
        data: 'd',
        model: {
            id: 'FolderID',
            hasChildren: 'HasChildren',
            children: {
                transport: {
                    read: {
                        url: 'Home.aspx/GetTreeNodes',
                        type: 'POST',
                        contentType: 'application/json; charset=utf-8',
                    },
                    parameterMap: function(data, operation) {
                        return JSON.stringify({ RootFolder: 'Documents' })
                    }
                }
            }
        }
    }
});

1 Answer, 1 is accepted

Sort by
0
Jeff
Top achievements
Rank 1
answered on 28 Feb 2013, 06:00 PM
Figured it out - I needed to format the static node differently:

data: { 'd': [{ FolderID: "Documents", FolderName: "Documents", hasChildren: true, expanded: true}] },
Tags
TreeView
Asked by
Jeff
Top achievements
Rank 1
Answers by
Jeff
Top achievements
Rank 1
Share this question
or