Share on Google+Share on Google+

Dojo Tree

This page discusses - Dojo Tree

Dojo Tree


In this section, you will learn about Dojo Tree widget. We will explain you how to create Tree control using Dojo Tree Widget. 

Test the sample online.

Dojo provides nice api to create tree that enhances the look and feel of web application.

Tree :  The tree is a GUI that helps to lists the hierarchical lists. The tree widget is a simple but the real power comes in the data. It represents the hierarchical structure of tree. Data is fed by the powerful API.

There are following steps for creating Dojo trees :

  • Create a rooted or rootless trees (forests)
  • Nest, each branch is independently expandable
  • Different icons for different leaf or branch classes
  • Tree data are stored in any implementing API.
  • Events fire when users clicked on it.
  • Add, remove or disable nodes of tree.

Here is the code of Program:


  <style type="text/css">
  @import "dojo/resources/dojo.css";
  @import "

  <script type="text/javascript" src="dojo.xd.js"
djConfig="parseOnLoad: true"></script>


<body class="tundra">
Simple Tree:<br><br>
  <div dojoType=""
 url="tree.txt" jsid="popStore" />
  <div dojoType="dijit.Tree" store="popStore" 
"sname" label="Tree"></div>

tree.txt: In JSON format.

{ label: 'name',
identifier: 'name',
items: [
{ name:'Students', type:'cat',
children: [
{ name:'Vinod', type:'st' },
{ name:'Suman', type:'st' },
{ name:'Deepak', type:'st' }

{ name:'Fruits', type: 'cat',
children: [
{ name:'Apple', type:'fr' },
{ name:'Mango', type:'fr' },
{ name:'Graps', type:'fr',
children: [
{ name:'Sweets', type:'gr' },
{ name:'Sour', type:'gr' },
{ name:'Salt', type:'gr' }


{ name:'Vegetables', type: 'cat'},
{ name:'Education', type:'cat'}

Output of the Program:

Test the sample online.



Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: Dojo Tree  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image