【发布时间】:2013-12-10 15:15:20
【问题描述】:
我正在尝试使用 javascript、JSON 数据和 extjs 构建一种文件浏览器类型的树结构。我使用的 JSON 数据是
[
{
"id": "Folder One",
"text": "<font color=\"#000000\" size=\"2\"><b>Folder One</b></font>",
"children": [
{
"id": "111",
"text": "<font color=\"#000000\" size=\"2\"><b>File1 (111)</b></font>",
"leaf": true
}
]
},
{
"id": "Folder Two",
"text": "<font color=\"#000000\" size=\"2\"><b>Folder Two</b></font>",
"children": [
{
"id": "111",
"text": "<font color=\"#000000\" size=\"2\"><b>File1 (111)</b></font>",
"leaf": true
}
]
}
]
此 JSON 通过以下代码传递给 Asynctreenode:
var fileList = JSON.parse(resp);
//alert("fileList from Server : "+JSON.stringify(fileList));
asyncTree = new Ext.tree.AsyncTreeNode({
id:'asyncTree',
expanded: true,
border : false,
children: [
{
"id":"asyncTreeChild",
"text":"<font color=#000000 size=2><b>My Computer</b></font>",
children:fileList
}
]
});
问题是当节点“文件夹一”下的文件不可点击时。相反,选择直接移动到“文件夹二”节点下的文件。节点“文件夹一”和“文件夹二”也返回正确的路径。它只是“文件夹一”下不可访问的文件。有什么想法吗?
【问题讨论】:
标签: javascript json extjs treepanel