small medium large xlarge

Back to: All Forums  Mastering Dojo
12 Sep 2013, 18:00
foni kumar (1 post)

Hi Experts,

I am very new to dojo script. I have a dojo tree structure and I want to add child to the folders manually by selecting a folder, doing right click, it should prompt me an option to create a folder under it.

Can someone please suggest how can I implement this feature in my folder “Continent”? Here if I select continent and do a right click on it then I should get a prompt to add folder. Now one entering the name of the folder say : “Earth” , the folder name should appear under continent. Can someone please suggest any modifications i can apply for the below code example. Appreciate for all your help!!

Example code:-

<link rel="stylesheet" href="../_static/js/dojo/../dijit/themes/claro/claro.css">
	<script>dojoConfig = {async: true, parseOnLoad: true}</script>
	<script src='../_static/js/dojo/dojo.js'></script>
require(["dojo/parser", "dojo/store/Memory", "dijit/tree/ObjectStoreModel", "dijit/Tree"]);
<body class="claro">
    <div data-dojo-type="dojo/store/Memory" data-dojo-id="myStore">
    <!-- Create store with inlined data.
        For larger data sets should use etc. instead of -->
    <script type="dojo/method">
            { id: 'world', name:'Continent', type:'planet', population: '6 billion'},
    <script type="dojo/method" data-dojo-event="getChildren" data-dojo-args="object">
         return this.query({parent:});

<div data-dojo-type="dijit/tree/ObjectStoreModel" data-dojo-id="myModel"
  data-dojo-props="store: myStore, query: {id: 'world'}"></div>

<!-- Create the tree -->
<div data-dojo-type="dijit/Tree" id="myTree" data-dojo-props="model: myModel"></div>