loading

Gets or sets the loading state of the Node. This flag indicates whether the node is currently in the process of loading its child items. Setting the loading flag is typically done internally during the load operation, but it can be accessed to check the current loading state.

Parameters

value Boolean (optional)

The value to set. If true, marks the node as currently loading. If false, marks the node as not loading. If omitted, the method acts as a getter and returns the current loading state.

Returns

Boolean—The current loading state of the node when called without parameters. Returns true if the node is currently loading its children, false otherwise.

Example - check loading state

<script>
var dataSource = new kendo.data.HierarchicalDataSource({
    transport: {
        read: {
            url: "https://demos.telerik.com/service/v2/core/Employees"
        }
    },
  schema: {
    model: {
      id: "EmployeeId",
      hasChildren: "HasEmployees"
    }
  }
});

dataSource.fetch(function() {
  var node = dataSource.at(0);
  /* The result can be observed in the DevTools(F12) console of the browser. */
  console.log(node.loading()); // outputs "false" - not loading initially
  
  // The load method checks loading state internally to prevent duplicate loads
  node.load(); // initiates loading, sets loading(true) internally
  
  // During load operation
  /* The result can be observed in the DevTools(F12) console of the browser. */
  console.log(node.loading()); // outputs "true" while loading
  
  // After load completes, loading is automatically set to false
});
</script>
In this article
loading
Not finding the help you need?
Contact Support