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

Lazy Loading TreeView is not working

6 Answers 187 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 19 Dec 2013, 10:13 PM
We are using kendo.all.min.js v2013.3.1119 

I call out my treeview like so:  <ul data-kendo-role="treeview"
         data-kendo-bind="source: dataSource, events: { select: onSelect }"
         data-kendo-load-on-demand="true"
         data-kendo-text-field="name"></ul>


self.kendoModel.dataSource = new kendo.data.HierarchicalDataSource({
                transport: {
read: {
                        type: "GET",
                        dataType: "json",
                        contentType: "application/json",
                        url: apiUrlHelper.getPath('collections') +  "/"
                    }
                },
                schema: {
                    model: {
                        id:"id",
                        children   : "items",
                        hasChildren: true
                    }
                }
            });

When I first load the page, I get the roots of all items in the tree, and when I click on the expander the class changes on the html element, but I don't see any new requests to the server for additional information. 

I've tried adding a custom transport and a parameter map, but it's not helping.

Here's a sample of the json used to populate the tree:

[{"id":192,"name":"a new collection","customerId":1,"createdBy":"admin","lastModifiedDate":null,"createdDate":"2013-12-17","isprivate":1,"managers":[],"items":[]},{"id":1986,"name":null,"customerId":1,"createdBy":"admin","lastModifiedDate":null,"createdDate":"2013-12-18","isprivate":1,"managers":[],"items":[]}]


6 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 20 Dec 2013, 07:50 AM
Hello Josh,

Instantiate the treeview from a div element rather than a ul element. Here's a jsbin that shows this. An empty UL overrides the dataSource declaration at this time.

Regards,
Alex Gyoshev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Josh
Top achievements
Rank 1
answered on 20 Dec 2013, 02:38 PM
Actually, I had tried it with both a div and a ul.

It started working when I removed children   : "items" from my schema model. 
0
Yevgeniy
Top achievements
Rank 1
answered on 24 Jul 2014, 09:44 PM
Hello, i have exactly same issue. i am calling web api rest srv in read. 
Josh please let me know if you have solved this.

Thank you!
0
Yevgeniy
Top achievements
Rank 1
answered on 24 Jul 2014, 09:47 PM
I have exactly the same issue. calling api using Web api, hasChildren: true, but displays only root level with out expand arrow, and double click does nothing, not making ajax call with ?queryString as an id.
0
Atanas Korchev
Telerik team
answered on 28 Jul 2014, 03:08 PM
Hello,

We would need some sample code which replicates the issue. You can attach a runnable project to this forum thread or start a new support ticket if you don't want to disclose private information.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Chris
Top achievements
Rank 2
Veteran
answered on 04 Jun 2016, 01:12 AM
Confirming that removing the children tag from the schema model worked for me.
Tags
TreeView
Asked by
Josh
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Josh
Top achievements
Rank 1
Yevgeniy
Top achievements
Rank 1
Atanas Korchev
Telerik team
Chris
Top achievements
Rank 2
Veteran
Share this question
or