无法将数据传递给Dynatree

时间:2014-01-03 06:13:27

标签: javascript jquery json dynatree jquery-dynatree

我无法将数据传递给Dynatree。

我有一个JS对象: enter image description here

我在做

 var data=JSON.stringify(treeData);

我收到了这个JSON字符串:

"{"data":"Banner","attr":{"Id":"1","ParentId":"","RootId":"1","Level":"0","Operation":"0"},"state":"closed","children":[{"data":"BWS","attr":{"Id":"54","ParentId":"1","RootId":"1","Level":"1","Operation":"0"},"state":"closed","children":[{"data":"BWS ID","attr":{"Id":"117","ParentId":"54","RootId":"1","Level":"2","Operation":"0"},"state":"closed","children":[{"data":"New node","attr":{"Id":"122","ParentId":"117","RootId":"1","Level":"3","Operation":"0"},"state":"closed","children":[{"data":"New node","attr":{"Id":"125","ParentId":"122","RootId":"1","Level":"4","Operation":"0"},"state":"closed","children":[{"data":"New node","attr":{"Id":"127","ParentId":"125","RootId":"1","Level":"5","Operation":"0"},"state":"closed","children":[]}]},{"data":"New node","attr":{"Id":"126","ParentId":"122","RootId":"1","Level":"4","Operation":"0"},"state":"closed","children":[{"data":"ghj","attr":{"Id":"146","ParentId":"126","RootId":"1","Level":"5","Operation":"0"},"state":"closed","children":[]}]}]},{"data":"BWS DD","attr":{"Id":"123","ParentId":"117","RootId":"1","Level":"3","Operation":"0"},"state":"closed","children":[]},{"data":"BWS FF","attr":{"Id":"157","ParentId":"117","RootId":"1","Level":"3","Operation":"0"},"state":"closed","children":[]},{"data":"BWS OO","attr":{"Id":"162","ParentId":"117","RootId":"1","Level":"3","Operation":"0"},"state":"closed","children":[]}]}]}]}"

修改

1)我收到此错误:

"Uncaught invalid data type for {"data":"Banne ...."

2)我尝试了var data="["+JSON.stringify(treeData)+"]";,但它没有用,也没有显示任何内容。

0 个答案:

没有答案