itemChildren
Returns a list of all direct child items.
Parameters
item kendo.data.OrgChartModel
(optional)
The parent item. If this parameter is not specified, the root level items will be returned.
fromView bool
(optional)
Whether the data should be taken from the dataSource.view()
(only the visible items) or from the .data()
call (all loaded items in the DataSource). If this parameter is not specified, the items will be taken from the data()
method.
Returns
Array
The list of all direct child items.
Example
<script>
var dataSource = new kendo.data.OrgChartDataSource({
data: [
{ id: 1, name: "Jill", title: "Boss", expanded: true },
{ id: 2, name: "James", title: "Lead", expanded: true, parentId: 1 },
{ id: 3, name: "Joe", title: "Worker", expanded: true, parentId: 2 },
{ id: 4, name: "Jack", title: "Worker", expanded: true, parentId: 2 },
]
});
dataSource.read().then(function() {
var children = dataSource.itemChildren(dataSource.data()[0]);
console.log(children);
});
</script>