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

.read() is undefined in the dataSource

1 Answer 150 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Svetlin
Top achievements
Rank 1
Svetlin asked on 15 Nov 2013, 03:43 PM
Hi Kendo team,

I have a problem with reading the datasource. 

 data = new kendo.data.HierarchicalDataSource({
//----i am using this one---
                //transport: {
                //    read: function (options) {
                //        $.ajax({
                //            url: '/Inventory/GetcategoryTree',
                //            type: "GET",
                //            dataType: "json"
                //        });
                //    }
                //},
//-----or this one------
                transport: {
                    read: {
                        url: function () {
                            return '/Inventory/GetcategoryTree';
                        },
                        create: {
                            dataType: "json",
                            type: "GET",
                            cache: true
                        }

                    }
                },
                schema: {
                    model: {
                        id: "Id",
                        children: "Children"
                    }
                },
                scrollable: true,
                sort: { field: "CategoryName", dir: "desc" }
            });

Then i add the DS to the tree:


    var treeView = $("#treeview").kendoTreeView({
        dataSource: data,
        scrollable: true,
        dataTextField: "CategoryName",
        select: function (e) {
            this.expand(e.node);
        }
    }).data("kendoTreeView");

So now the problem is, when i call the treeView.dataSource.read() nothing happens and in debugger i see that the read() is undefined.(cant see it in the list of methods too)

Do you guys now when this ca occur, and under what circumstances. Is it the HierarchicalDataSource? I can see that the data source is there and i see the data too. However on break point in Chrome the dataSource is "B.extend.init"  

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 18 Nov 2013, 08:12 AM
Hi Svetlin,

What do you expect to happen when you call the read() method? What it does is to make another request to the remote service configured via the transport. The treeview will be refreshed when the response comes.

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
TreeView
Asked by
Svetlin
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or