2
我有一個響應JSON字符串的HTTP服務器。他們是這樣的:將自定義JSON解析爲ExtJS 4.1 TreeStore
{ ... "value":{ "children":[ { "path":"KEY_518693", "name":"KEY_518693", "children_count_overall":0, "children_page":1, "children_pages":1, "children_pagesize":10 ... } ], "children_count_overall":1, "children_page":1, "children_pages":1, "children_pagesize":1, "name":null, "path":null, ... } }
每一個要求有父節點(在"value"
),爲此,我要求孩子,這孩子(在"children"
),也有一些尋呼信息。
如果沒有指定父節點,它會將根節點作爲虛擬根節點的子節點返回。
我代理的"root"
屬性設置爲"value"
,所以代理知道哪裏來搜索節點,但我TreeStore的tree
構件具有load()
後,一個奇怪的結構:
tree: {
childNodes: [
{
childNodes: [], <-- no child?
data: {
children: [
{ ...the raw data of the "children" node (like in the example above)...}
],
... the data of the "value" node and some data from the implicit node model...
}
}
]
}
不知何故, "value"
中的對象被轉換爲節點並插入到樹中,但它在"children"
陣列中的對象將不會被轉換並最終成爲此"value"
節點的數據。