tags:

views:

28

answers:

0

Hi,

I am creating a dojo tree on Mozilla 3 programatically as following

var store = new dojo.data.ItemFileReadStore({
 "id": "treeSt",
 "data": _treeData
    }
);
var model = new dijit.tree.ForestStoreModel({
 "jsId": "tModel",
 "store": store,
 "rootId": "tems",
 "rootLabel": "TEMS",
 "query": {

"type": "root" }, "childrenAttr": ["children"] });

var tree = new dijit.Tree({
 "id": treeId,
 "model": model,
 "openOnClick": false,
 "onClick": setSelectedNode
    }
);

Everytime a node is to be added to the tree, I update my global variable _treeData, destory and recreate the tree. _treeData has all the json data for the tree. Is there any other way to maintain tree-data without having to maintain a global variable?

Moreover, when I try to serialize _treeData using dojo.toJson(_treeData) , I get an error - "Too Much Recursion" in firebug console. Is there any other way to do this?

Thanks, in advance, for your help.