Search results

Loading Animation in JavaScript (ES5) Tree Grid control

08 May 2023 / 2 minutes to read

The Tree Grid displays a loading indicator while the data is being fetched and bound to the tree grid during initial rendering, refreshing, and after performing any tree grid actions like sorting, paging and more.

The tree grid supports two indicator types, which can be enabled by setting the loadingIndicator.indicatorType property to Spinner or Shimmer. The default value of the indicator type is Spinner.

In the following sample, the Shimmer indicator is displayed while the tree grid is loading and refreshing when using the remote data.

Copied to clipboard
ej.treegrid.TreeGrid.Inject(ej.treegrid.Page, ej.treegrid.Sort);

var data = new{
  url: '',
  adaptor: new,
  crossDomain: true
var treeGridObj = new ej.treegrid.TreeGrid({
  dataSource: data,
  hasChildMapping: 'isParent',
  idMapping: 'TaskID',
  parentIdMapping: 'ParentItem',
  treeColumnIndex: 1,
  height: 400,
  allowPaging: true,
  allowSorting: true,
  loadingIndicator: { indicatorType: 'Shimmer' },
  columns: [
      { field: 'TaskID', headerText: 'Task ID', width: 120, textAlign: 'Right' },
      { field: 'TaskName', headerText: 'Task Name', width: 240, textAlign: 'Left' },
      { field: 'StartDate', headerText: 'Start Date', width: 140, textAlign: 'Right', type: 'date', format: 'yMd' },
      { field: 'Duration', headerText: 'Duration', width: 130, textAlign: 'Right' },
      { field: 'Progress', headerText: 'Progress', width: 130 }
  pageSettings: { pageCount: 3 }
Copied to clipboard
<!DOCTYPE html><html lang="en"><head>
    <title>EJ2 Tree Grid</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Typescript Tree Grid Control">
    <meta name="author" content="Syncfusion">
     <!-- Syncfusion Essential JS 2 Styles -->
    <link rel="stylesheet" href="">
    #container {
    visibility: hidden;

#loader {
  color: #008cff;
  font-family: 'Helvetica Neue','calibiri';
  font-size: 14px;
  height: 40px;
  left: 45%;
  position: absolute;
  top: 45%;
  width: 30%;
</style><script src="" type="text/javascript"></script>

    <div id="container">
        <div id="TreeGrid"></div>        

var ele = document.getElementById('container');
if(ele) { = "visible";
<script src="index.js" type="text/javascript"></script>