extjs 3.4 unable to access children of a node in a tree

353 views Asked by At

I am trying to build a file explorer kind of tree structure with javascript, JSON data and extjs . The JSON data that I am using for the same is

[
{
    "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
        }
    ]
}
]

This JSON is passed to the Asynctreenode by the following code:

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
                        }
                       ]
        });

The issue is when that the files under the node "Folder One" are unclickable. Instead the selection directly moves to the files under "Folder Two" node. The nodes "Folder One" and "Folder Two" are also returning proper paths. Its just the files under the "folder one" which are not accessible. Any ideas ?

1

There are 1 answers

0
Ojas Dubey On BEST ANSWER

I found what was the problem.. The id attribute of the children was same which was causing the problem. Changing it to distinct values (from 111 to something else) solved the issue.