I have developed a controller method that generates a JSON "file" on-the-fly when the corresponding URL is accessed. This file exists in memory and not saved on disk, as it's dynamically created when the URL is hit. I'm attempting to utilize this as my data source for a dojo tree, but unfortunately, the Tree fails to populate. Instead, it remains in a perpetual "waiting" state. Is there an alternative approach to loading the data into the Tree?
Below is the code snippet. The method "getFilterTree" in Grails returns a formatted JSON object.
var store = new dojo.data.ItemFileReadStore({
url: "/SkillsDB/search/getFilterTree"
});
var treeModel = new dijit.tree.ForestStoreModel({
store: store,
query: {
"type":"cat"
},
rootId: "root",
rootLabel: "Filter Categories",
childrenAttrs: ["children"]
});
new dijit.Tree({
model: treeModel
},
"treeOne");