PDA

View Full Version : TreeView: No leaf attributes wreaking havoc.



MattDC1023
19 Aug 2011, 12:56 PM
Hi,

I'm thoroughly stuck with a JSON feed coming out of our CQ5 CMS that isn't putting the leaf attribute on the youngest child nodes. Example below.

The problem when loading this into my Tree is that when I click on the youngest child nodes, it reloads the entire tree into that node and continues to do so ad infinitum. My biggest question is, am I going to be okay with this JSON? Is there something I can do on the Ext JS side to force it to recognize a node as a leaf if it has no children attribute?

Here's the JSON named 'articles.section.json'

[
{
"name":"arts",
"text":"arts",
"type":"cq:Page",
"cls":"folder",
"children":[
{
"name":"culturegabfest",
"text":"culturegabfest",
"type":"cq:Page",
"cls":"folder"
},
{
"name":"books",
"text":"books",
"type":"cq:Page",
"cls":"folder"
},

{
"name":"the_movie_club",
"text":"the_movie_club",
"type":"cq:Page",
"cls":"folder"
}
]
}
]

Also, here's my Ext JS code:


var treeLoader = new Ext.tree.TreeLoader({
dataUrl:'articles.section.json'
});

var rootNode = new Ext.tree.AsyncTreeNode({
text:'Root'
});

var tree = new Ext.tree.TreePanel({
renderTo:'treecontainer',
loader:treeLoader,
root:rootNode
});