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);
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(root.level()); // outputs "0"
root.load(); // Load child nodes
var child = dataSource.get(2);
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(child.level()); // outputs "1"
</script>
In this article