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

Force load and expand of node with LoadOnDemand(true)

1 Answer 175 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 16 Mar 2014, 11:58 AM
I'm trying to force the load and expand of a node when using LoadOnDemand. I've seen several examples of this in the forums, but I can't get it to work. This is my code:

var tv = $("#FolderTree").data('kendoTreeView');
 
var selectedItem = tv.dataItem(tv.select());
 
var selectedDataItem = tv.dataItem(tv.findByUid(selectedItem.uid));
 
selectedDataItem.loaded(false);
 
selectedDataItem.load();
 
tv.expand(selectedItem)

The children are being retrieved from the server, but the node is not expanded and the children of the node (which I'm trying to access) are not available in the datasource.

Why is the node not expanding?

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 19 Mar 2014, 08:49 AM
Hi Paul,

You are trying to expand a Kendo UI Model instance (selectedItem), while the expand method expects a DOM element, a jQuery object or a selector string.

http://docs.telerik.com/kendo-ui/api/web/treeview#methods-expand

On a side note, you don't need to execute the load() method explicitly. Expanding a node will load it automatically if needed.

Regards,
Dimo
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
Tags
TreeView
Asked by
Paul
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or