Edit this page

level

Gets the current nesting level of the node within the data source.

Returns

Number the zero based level of the node.

Example - get the level of the node

<script>
var dataSource = new kendo.data.HierarchicalDataSource({
    data: [
        {
            id: 1,
            text: "Root",
            items: [
                { id: 2, text: "Child" }
            ]
        }
    ]
});
dataSource.read();
var root = dataSource.get(1);
console.log(root.level()); // outputs "0"
root.load(); // Load child nodes
var child = dataSource.get(2);
console.log(child.level()); // outputs "1"
</script>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy