- Dynamically adding nodes
- Dynamically removing nodes
- Dynamically update nodes
- Dynamically refresh nodes
- Dynamically move nodes
Contact Support
Nodes manipulation in EJ2 React TreeView component
28 Feb 202524 minutes to read
The TreeView component provides essential methods for dynamically managing nodes, offering the ability to create a highly interactive and customizable tree structure,
These methods provide the flexibility to add, remove, update, refresh, or relocate nodes as needed, facilitating a fully interactive and customizable TreeView structure.
Dynamically adding nodes
The addNodes
method of TreeView allows you to insert new nodes at designated positions within the TreeView by passing the necessary node information. You can add both parent and child nodes by specifying their target ID.
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { TreeViewComponent } from '@syncfusion/ej2-react-navigations';
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
function App() {
let treeObj;
// Local data source for TreeView component
let localData = [
{ id: 1, name: 'Parent 1', hasChild: true, expanded: true },
{ id: 2, pid: 1, name: 'Child 1' },
{ id: 3, pid: 1, name: 'Child 2' },
{ id: 4, pid: 1, name: 'Child 3' },
{ id: 7, name: 'Parent 2', hasChild: true },
{ id: 8, pid: 7, name: 'Child 1' },
{ id: 9, pid: 7, name: 'Child 2' },
{ id: 10, pid: 7, name: 'Child 3' },
];
let fields = { dataSource: localData, id: 'id', text: 'name', parentID: 'pid', hasChildren: 'hasChild' };
// Button click event handler to add a parent node
const btnClick1 = () => {
treeObj.addNodes([
{ id: 12, name: 'New Parent' },
{ id: 13, pid: 12, name: 'New Child1' },
]);
};
// Button click event handler to add a child node
const btnClick2 = () => {
treeObj.addNodes([{ id: 11, name: 'New Child2', pid: 1 }], '1', null);
};
return (<div className='control-pane'>
<div className='control-section'>
<div className='control_wrapper'>
{/* Render TreeView */}
<TreeViewComponent fields={fields} ref={(tree) => { treeObj = tree; }} />
</div>
<div id="btn">
<ButtonComponent id="addtree1" cssClass="e-primary inline-element right" onClick={btnClick1.bind(this)}> Add parent node </ButtonComponent>
<ButtonComponent id="addtree2" cssClass="e-primary inline-element right" onClick={btnClick2.bind(this)}> Add child node </ButtonComponent>
</div></div>
</div>);
}
export default App;
ReactDOM.render(<App />, document.getElementById('sample'));
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { TreeViewComponent } from '@syncfusion/ej2-react-navigations';
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
function App() {
let treeObj: TreeViewComponent;
// Local data source for TreeView component
let localData: { [key: string]: Object }[] = [
{ id: 1, name: 'Parent 1', hasChild: true, expanded: true },
{ id: 2, pid: 1, name: 'Child 1' },
{ id: 3, pid: 1, name: 'Child 2' },
{ id: 4, pid: 1, name: 'Child 3' },
{ id: 7, name: 'Parent 2', hasChild: true },
{ id: 8, pid: 7, name: 'Child 1' },
{ id: 9, pid: 7, name: 'Child 2' },
{ id: 10, pid: 7, name: 'Child 3' },
];
let fields: object = { dataSource: localData, id: 'id', text: 'name', parentID: 'pid', hasChildren: 'hasChild' };
// Add parent node to TreeView
function btnClick1(): void {
treeObj.addNodes([
{ id: 12, name: 'New Parent' },
{ id: 13, pid: 12, name: 'New Child1' },
]);
}
// Add child node to TreeView
function btnClick2(): void {
treeObj.addNodes([{ id: 11, name: 'New Child2', pid: 1 }], '1', null);
}
return (
<div className='control-pane'>
<div className='control-section'>
<div id='treeparent'>
{/* Render TreeView */}
<TreeViewComponent fields={fields} ref={(tree) => { treeObj = tree }} />
</div>
<div id="btn">
<ButtonComponent id="addtree1" cssClass="e-primary inline-element right" onClick={btnClick1.bind(this)}> Add parent node </ButtonComponent>
<ButtonComponent id="addtree2" cssClass="e-primary inline-element right" onClick={btnClick2.bind(this)}> Add child node </ButtonComponent>
</div>
</div>
</div>
)
}
export default App;
ReactDOM.render(<App />, document.getElementById('sample'));
<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React TreeView</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Essential JS 2 for React Components" />
<meta name="author" content="Syncfusion" />
<link href="style.css" rel="stylesheet"/>
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-react-navigations/styles/material.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='sample'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
#treeparent {
display: block;
max-width: 350px;
max-height: 350px;
margin: auto;
overflow: auto;
border: 1px solid #dddddd;
border-radius: 3px;
}
#btn{
margin-left: 40%;
margin-top: 20px;
}
Dynamically removing nodes
The TreeView removeNodes
method lets you remove multiple nodes by providing their IDs. You can remove both parent and child nodes.
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { TreeViewComponent } from '@syncfusion/ej2-react-navigations';
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
function App() {
let treeObj;
// Local data source for TreeView component
let localData = [
{ id: 1, name: 'Parent 1', hasChild: true, expanded: true },
{ id: 2, pid: 1, name: 'Child 1' },
{ id: 3, pid: 1, name: 'Child 2' },
{ id: 4, pid: 1, name: 'Child 3' },
{ id: 7, name: 'Parent 2', hasChild: true, expanded: true },
{ id: 8, pid: 7, name: 'Child 1' },
{ id: 9, pid: 7, name: 'Child 2' },
{ id: 10, pid: 7, name: 'Child 3' },
];
let fields = { dataSource: localData, id: 'id', text: 'name', parentID: 'pid', hasChildren: 'hasChild' };
// Button click event handler to remove a single node
const btnClick1 = () => {
treeObj.removeNodes(['7']);
};
// Button click event handler to remove a multiple nodes
const btnClick2 = () => {
treeObj.removeNodes(['3', '4']);
};
return (<div className='control-pane'>
<div className='control-section'>
<div id='treeparent'>
{/* Render TreeView */}
<TreeViewComponent fields={fields} ref={(tree) => { treeObj = tree }} />
</div>
<div id="btn">
<ButtonComponent id="addtree1" cssClass="e-primary inline-element right" onClick={btnClick1.bind(this)}> Remove parent node </ButtonComponent>
<ButtonComponent id="addtree2" cssClass="e-primary inline-element right" onClick={btnClick2.bind(this)}> Remove child node </ButtonComponent> </div>
</div>
</div>);
}
export default App;
ReactDOM.render(<App />, document.getElementById('sample'));
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { TreeViewComponent } from '@syncfusion/ej2-react-navigations';
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
function App() {
let treeObj: TreeViewComponent;
// Local data source for TreeView component
let localData: { [key: string]: Object }[] = [
{ id: 1, name: 'Parent 1', hasChild: true, expanded: true },
{ id: 2, pid: 1, name: 'Child 1' },
{ id: 3, pid: 1, name: 'Child 2' },
{ id: 4, pid: 1, name: 'Child 3' },
{ id: 7, name: 'Parent 2', hasChild: true },
{ id: 8, pid: 7, name: 'Child 1' },
{ id: 9, pid: 7, name: 'Child 2' },
{ id: 10, pid: 7, name: 'Child 3' },
];
let fields: object = { dataSource: localData, id: 'id', text: 'name', parentID: 'pid', hasChildren: 'hasChild' };
// Remove single node from TreeView
function btnClick1(): void {
treeObj.removeNodes(['7']);
}
// Remove multiple nodes from TreeView
function btnClick2(): void {
treeObj.removeNodes(['3', '4']);
}
return (
<div className='control-pane'>
<div className='control-section'>
<div id='treeparent'>
{/* Render TreeView */}
<TreeViewComponent fields={fields} ref={(tree) => { treeObj = tree }} />
</div>
<div id="btn">
<ButtonComponent id="addtree1" cssClass="e-primary inline-element right" onClick={btnClick1.bind(this)}> Remove parent node </ButtonComponent>
<ButtonComponent id="addtree2" cssClass="e-primary inline-element right" onClick={btnClick2.bind(this)}> Remove child node </ButtonComponent> </div>
</div>
</div>
)
}
export default App;
ReactDOM.render(<App />, document.getElementById('sample'));
<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React TreeView</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Essential JS 2 for React Components" />
<meta name="author" content="Syncfusion" />
<link href="style.css" rel="stylesheet"/>
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-react-navigations/styles/material.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='sample'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
#treeparent {
display: block;
max-width: 350px;
max-height: 350px;
margin: auto;
overflow: auto;
border: 1px solid #dddddd;
border-radius: 3px;
}
#btn {
margin-left: 40%;
margin-top: 20px;
}
Dynamically update nodes
The TreeView component has the updateNode
method, which allows you to change a specific node’s text by providing its target (either the node ID or element) and the new text. To enable text editing, set the allowEditing
property to true, ensuring correct functionality of the updateNode
method.
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { TreeViewComponent } from '@syncfusion/ej2-react-navigations';
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
function App() {
let treeObj;
// local data source for TreeView component
let localData = [
{ id: 1, name: 'Parent 1', hasChild: true, expanded: true },
{ id: 2, pid: 1, name: 'Child 1' },
{ id: 3, pid: 1, name: 'Child 2' },
{ id: 4, pid: 1, name: 'Child 3' },
{ id: 7, name: 'Parent 2', hasChild: true },
{ id: 8, pid: 7, name: 'Child 1' },
{ id: 9, pid: 7, name: 'Child 2' },
{ id: 10, pid: 7, name: 'Child 3' },
];
let fields = { dataSource: localData, id: 'id', text: 'name', parentID: 'pid', hasChildren: 'hasChild' };
let allowEditing = true;
const btnClick1 = () => {
treeObj.updateNode('4', 'Node updated'); // Update node having id 4 in TreeView
};
return (<div className='control-pane'>
<div className='control-section'>
<div id='treeparent'>
{/* Render TreeView */}
<TreeViewComponent fields={fields} allowEditing={allowEditing} ref={(tree) => { treeObj = tree }} /></div>
<div id="btn">
<ButtonComponent id="addtree1" cssClass="e-primary inline-element right" onClick={btnClick1.bind(this)}> Update node </ButtonComponent>
</div>
</div>
</div>);
}
export default App;
ReactDOM.render(<App />, document.getElementById('sample'));
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { TreeViewComponent } from '@syncfusion/ej2-react-navigations';
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
function App() {
let treeObj: TreeViewComponent;
// local data source for TreeView component
let localData: { [key: string]: Object }[] = [
{ id: 1, name: 'Parent 1', hasChild: true, expanded: true },
{ id: 2, pid: 1, name: 'Child 1' },
{ id: 3, pid: 1, name: 'Child 2' },
{ id: 4, pid: 1, name: 'Child 3' },
{ id: 7, name: 'Parent 2', hasChild: true },
{ id: 8, pid: 7, name: 'Child 1' },
{ id: 9, pid: 7, name: 'Child 2' },
{ id: 10, pid: 7, name: 'Child 3' },
];
let fields: object = { dataSource: localData, id: 'id', text: 'name', parentID: 'pid', hasChildren: 'hasChild' };
let allowEditing: boolean = true;
// Update node having id 4 in TreeView
function btnClick1(): void {
treeObj.updateNode('4', 'Node updated');
}
return (
<div className='control-pane'>
<div className='control-section'>
<div id='treeparent'>
{/* Render TreeView */}
<TreeViewComponent fields={fields} allowEditing={allowEditing} ref={(tree) => { treeObj = tree }} /></div>
<div id="btn">
<ButtonComponent id="addtree1" cssClass="e-primary inline-element right" onClick={btnClick1.bind(this)}> Update node </ButtonComponent>
</div>
</div>
</div>
)
}
export default App;
ReactDOM.render(<App />, document.getElementById('sample'));
<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React TreeView</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Essential JS 2 for React Components" />
<meta name="author" content="Syncfusion" />
<link href="style.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-react-navigations/styles/material.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='sample'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
#treeparent {
display: block;
max-width: 350px;
max-height: 350px;
margin: auto;
overflow: auto;
border: 1px solid #dddddd;
border-radius: 3px;
}
#btn{
margin-left: 40%;
margin-top: 20px;
}
Dynamically refresh nodes
The refreshNode
method in TreeView allows you to update the content of a specific node by providing its target and the new details. To retrieve the current details of the node, use the getTreeData
method in conjunction with the node’s ID. This method refreshes a designated node within the TreeView.
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { TreeViewComponent } from '@syncfusion/ej2-react-navigations';
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
function App() {
let treeObj;
// Local data source for TreeView component
let localData = [
{ id: 1, name: 'Parent 1', hasChild: true, expanded: true },
{ id: 2, pid: 1, name: 'Child 1' },
{ id: 3, pid: 1, name: 'Child 2' },
{ id: 4, pid: 1, name: 'Child 3' },
{ id: 7, name: 'Parent 2', hasChild: true, expanded: true },
{ id: 8, pid: 7, name: 'Child 1' },
{ id: 9, pid: 7, name: 'Child 2' },
{ id: 10, pid: 7, name: 'Child 3' },
];
let fields = { dataSource: localData, id: 'id', text: 'name', parentID: 'pid', hasChildren: 'hasChild' };
const btnClick1 = () => {
var nodeData = treeObj.getTreeData('4');
//Update the name text from backend.
nodeData[0].name = 'Node refreshed';
// Refresh the updated data.
treeObj.refreshNode('4', nodeData);
};
return (<div className='control-pane'>
<div className='control-section'>
<div className='control_wrapper'>
{/* Render TreeView */}
<TreeViewComponent fields={fields} ref={(tree) => { treeObj = tree; }} />
<ButtonComponent id="addtree1" cssClass="e-primary inline-element right" onClick={btnClick1.bind(this)}> Refresh node </ButtonComponent>
</div>
<div id="display"></div>
</div>
</div>);
}
export default App;
ReactDOM.render(<App />, document.getElementById('sample'));
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { TreeViewComponent } from '@syncfusion/ej2-react-navigations';
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
function App() {
let treeObj: TreeViewComponent;
// Hierarchical data source for TreeView component
let localData: { [key: string]: Object }[] = [
{ id: 1, name: 'Parent 1', hasChild: true, expanded: true },
{ id: 2, pid: 1, name: 'Child 1' },
{ id: 3, pid: 1, name: 'Child 2' },
{ id: 4, pid: 1, name: 'Child 3' },
{ id: 7, name: 'Parent 2', hasChild: true, expanded: true },
{ id: 8, pid: 7, name: 'Child 1' },
{ id: 9, pid: 7, name: 'Child 2' },
{ id: 10, pid: 7, name: 'Child 3' },
];
let fields: object = { dataSource: localData, id: 'id', text: 'name', parentID: 'pid', hasChildren: 'hasChild' };
function btnClick1(): void {
var nodeData = treeObj.getTreeData('4');
//Update the node text from backend.
nodeData[0].name = 'Node refreshed';
// Refresh the updated data.
treeObj.refreshNode('4', nodeData);
}
return (
<div className='control-pane'>
<div className='control-section'>
<div id='treeparent'>
{/* Render TreeView */}
<TreeViewComponent fields={fields} ref={(tree) => { treeObj = tree }} />
</div>
<div id="btn">
<ButtonComponent id="addtree1" cssClass="e-primary inline-element right" onClick={btnClick1.bind(this)}> Refresh node </ButtonComponent>
</div>
</div>
</div>
)
}
export default App;
ReactDOM.render(<App />, document.getElementById('sample'));
<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React TreeView</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Essential JS 2 for React Components" />
<meta name="author" content="Syncfusion" />
<link href="style.css" rel="stylesheet"/>
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-react-navigations/styles/material.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='sample'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
#treeparent {
display: block;
max-width: 350px;
max-height: 350px;
margin: auto;
overflow: auto;
border: 1px solid #dddddd;
border-radius: 3px;
}
#btn{
margin-left: 40%;
margin-top: 20px;
}
Dynamically move nodes
The moveNodes
method in TreeView allows you to relocate a node by defining the node to be moved, the target location, and the index within that target. It facilitates the repositioning of nodes within the same TreeView based on the specified target.
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { TreeViewComponent } from '@syncfusion/ej2-react-navigations';
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
function App() {
let treeObj;
// Hierarchical data source for TreeView component
let localData = [
{ id: 1, name: 'Parent 1', hasChild: true, expanded: true },
{ id: 2, pid: 1, name: 'Child 1' },
{ id: 3, pid: 1, name: 'Child 2' },
{ id: 4, pid: 1, name: 'Child 3' },
{ id: 7, name: 'Parent 2', hasChild: true },
{ id: 8, pid: 7, name: 'Child 1' },
{ id: 9, pid: 7, name: 'Child 2' },
{ id: 10, pid: 7, name: 'Child 3' },
];
let fields = { dataSource: localData, id: 'id', text: 'name', parentID: 'pid', hasChildren: 'hasChild' };
const btnClick1 = () => {
treeObj.moveNodes(['2'], '3', 1); // Move the node with id 2 to the target node with id 3 to the index of 1.
};
return (<div className='control-pane'>
<div className='control-section'>
<div className='control_wrapper'>
{/* Render TreeView */}
<TreeViewComponent fields={fields} ref={(tree) => { treeObj = tree; }} />
<ButtonComponent id="addtree1" cssClass="e-primary inline-element right" onClick={btnClick1.bind(this)}> Move node </ButtonComponent>
</div>
<div id="display"></div>
</div>
</div>);
}
export default App;
ReactDOM.render(<App />, document.getElementById('sample'));
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { TreeViewComponent } from '@syncfusion/ej2-react-navigations';
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
function App() {
let treeObj: TreeViewComponent;
// Local data source for TreeView component
let localData: { [key: string]: Object }[] = [
{ id: 1, name: 'Parent 1', hasChild: true, expanded: true },
{ id: 2, pid: 1, name: 'Child 1' },
{ id: 3, pid: 1, name: 'Child 2' },
{ id: 4, pid: 1, name: 'Child 3' },
{ id: 7, name: 'Parent 2', hasChild: true },
{ id: 8, pid: 7, name: 'Child 1' },
{ id: 9, pid: 7, name: 'Child 2' },
{ id: 10, pid: 7, name: 'Child 3' },
];
let fields: object = { dataSource: localData, id: 'id', text: 'name', parentID: 'pid', hasChildren: 'hasChild' };
function btnClick1(): void {
treeObj.moveNodes(['2'], '3', 1); // Move the node with id 2 to the target node with id 3 to the index of 1.
}
return (
<div className='control-pane'>
<div className='control-section'>
<div id='treeparent'>
{/* Render TreeView */}
<TreeViewComponent fields={fields} ref={(tree) => { treeObj = tree }} />
</div>
<div id="btn">
<ButtonComponent id="addtree1" cssClass="e-primary inline-element right" onClick={btnClick1.bind(this)}> Move node </ButtonComponent></div>
</div>
</div>
)
}
export default App;
ReactDOM.render(<App />, document.getElementById('sample'));
<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React TreeView</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Essential JS 2 for React Components" />
<meta name="author" content="Syncfusion" />
<link href="style.css" rel="stylesheet"/>
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-react-navigations/styles/material.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='sample'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
#treeparent {
display: block;
max-width: 350px;
max-height: 350px;
margin: auto;
overflow: auto;
border: 1px solid #dddddd;
border-radius: 3px;
}
#btn {
margin-left: 40%;
margin-top: 20px;
}