title: Why is my dijit.Tree not populated from json source?
body: <p>I am new to dojo and spring development. I am trying to populate a Tree widget using a json response from a spring-mvc controller. I'm following the examples from the dojocampus website quite closely.</p>
  
  <p>Firstly if I use a local data source it works ok:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      dojo.require("dojo.data.ItemFileReadStore");
      dojo.require("dijit.Tree");
  
      dojo.addOnLoad(function() {
          var rawdata = [{"rid":"b1c","name":"Test Parent","children":[{"rid":"1c4","name":"Test Child 1","children":[]},{"rid":"ee6","name":"Test Child 2","children":[]}]}];
  
          var store = new dojo.data.ItemFileReadStore({
              data: {
                  identifier: 'rid',
                  label: 'name',
                  items: rawdata
              }
          });
  
          var treeModel = new dijit.tree.TreeStoreModel({
              store: store,
              query: {name: 'Test Parent'},
              childrenAttrs: ["children"]
          });
  
          new dijit.Tree({
              model: treeModel
          },
          "treeOne");
      });
  &lt;/script&gt;
  
  &lt;div id="treeOne"&gt;
  &lt;/div&gt;    
  </code></pre>
  
  <p>But if I use my json url the tree doesn't appear:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      dojo.require("dojo.data.ItemFileReadStore");
      dojo.require("dijit.Tree");
  
      dojo.addOnLoad(function() {
  
          var store = new dojo.data.ItemFileReadStore({
              url: "/Demo2/glossaryobjects/categories.json"
          });
  
          var treeModel = new dijit.tree.TreeStoreModel({
              store: store,
              query: {name: 'Test Parent'},
              childrenAttrs: ["children"]
          });
  
          new dijit.Tree({
              model: treeModel
          },
          "treeOne");
      });
  &lt;/script&gt;
  
  &lt;div id="treeOne"&gt;
  &lt;/div&gt; 
  </code></pre>
  
  <p>When I debug with Firebug I can see that the json response appears to be loaded correctly. It looks like this:</p>
  
  <p>{"identifier":"rid","items":{"rid":"b1c","name":"Test Parent",
  "children":[{"rid":"1c4","name":"Test Child 1","children":[]},
  {"rid":"ee6","name":"Test Child 2","children":[]}]}, "label":"name"}</p>
  
  <p>There is an error in Firebug:</p>
  
  <p>"dijit.tree.TreeStoreModel: query {"name":"Test Parent"} returned 0 items, but must return exactly one item"</p>
  
  <p>It looks like the ItemFileReadStore is not correctly loaded. Anyone know what I'm doing wrong? I've been tearing my hair out for days trying to get this to work, so any help is much appreciated.</p>
  
  <p>Cheers,
  Rod.</p>