Ok so, i have this site that i am putting together in the play framework. It basically connects to an FTP site on the back end, retrieves a list of folders/files and sends that to a basic ExtJS front-end as JSON.
I have it working so that the Tree Panel gets populated correctly, but it doesn't seem to be doing anything special when i expand a non-leaf node.
Based on what i've read, it should use the data url, and pass a node parameter with the id of the node to that data url to get the data for the child nodes, but in firebug i don't see any requests being sent for that data.
What do i need to do to allow the ajax calls to fire so that nodes that have children will get them dynamically when the node is expanded?
Here is the relevant code for reference:
Ext.onReady(function() {
new Ext.Viewport({
layout: 'border',
defaults: {
height: 100,
width: 250,
collapseMode: 'mini'
},
items : [
{
region: 'center',
margins: '5 5 0 0',
contentEl: 'center-content'
},
{
id: 'file-tree',
region: 'west',
title: 'Files',
split: true,
collapsible: true,
xtype: 'treepanel',
autoScroll: true,
loader: new Ext.tree.TreeLoader({
dataUrl: 'http://localhost:9000/application/listFiles',
}),
root: new Ext.tree.AsyncTreeNode({
expand: true,
text: "/",
id: "/"
}),
rootVisibile: true,
listeners: {
click: function(n) {
Ext.Msg.alert('File Tree Click', 'You clicked: ' + n.attributes.id);
}
}
}
]
});
});
The id returned in the JSON is the complete path to sub directory i would like to expand, and the listfiles action will take that parameter and return the appropriate files.
As requested, here is a snippet of the JSON output:
[
{
id: "/./",
text: "./",
leaf: false,
children: [ ]
},
{
id: "/../",
text: "../",
leaf: false,
children: [ ]
},
{
id: "/.ftpquota",
text: ".ftpquota",
leaf: true,
children: [ ]
},
{
id: "/.htaccess",
text: ".htaccess",
leaf: true,
children: [ ]
},
{
id: "/022610.html",
text: "022610.html",
leaf: true,
children: [ ]
},
{
id: "/Gail/",
text: "Gail/",
leaf: false,
children: [ ]
}
]
That last item is an example of the folder that i am looking to dynamically load the children to.