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

Children of DataItem

1 Answer 272 Views
Hierarchical Data Source
This is a migrated thread and some comments may be shown as answers.
Kazimierz
Top achievements
Rank 1
Kazimierz asked on 20 Jun 2013, 08:42 AM
Hi,
I have a static HierarchicalDataSource defined in a file. I use it as source for a TreeView. TreeView has an 'expand' event fired before expand actually occurs. In that event I can get dataItem related to the node that is being expanded. I need to get children of that dataItem but I cannot see any method/property on dataItem that would allow me to get them. Is there any way to get/load child items?

I would be most grateful for any help :)

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 24 Jun 2013, 07:18 AM
Hello,

You can use the node children field to access the item child dataSource and its items e.g.

function expand(e) {
    var dataItem = this.dataItem(e.node);
    if (dataItem.hasChildren) {
        var childItems = dataItem.children.data();
    }           
}
Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Hierarchical Data Source
Asked by
Kazimierz
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or