robtcallahan
24 Apr 2007, 9:31 AM
Hi folks,
So I my layout working yesterday and I now understand it better. However, I'm stumped again and need your assistance.
I'm reading from a database obtaining a list of user files and folders. I want to load the top set of files/folders only. Then load subsequent folders when the plus sign is clicked. Reason is, it could be a huge hierarchy and I don't want to load it all at once. So I need a way to:
1. Create a tree and define a root node
2. create a set of folders on the root
3. apply events to the folders so that they are loaded and rendered upon clicking
on the plus sign to expand the hierarchy.
So I've attempted 1 and 2 below. It obviously doesn't work and that's why I'm posting.
As for 3, I have no idea right now how to do that.
Here's what I have for 1 and 2:
folderTree = new Tree.TreePanel('folders', {
animate: true,
enableDD: false,
containerScroll: true
});
// set the root node
folderTreeRoot = new Tree.AsyncTreeNode({
text: '/',
draggable: false,
id: 0
});
folderTree.setRootNode(folderTreeRoot);
foldersDS.each(function() {
var node = new Tree.AsyncTreeNode({
text: this.data.text,
draggable: false,
id: this.data.id,
cls: "leaf",
href: "../php/xdrive_get_user_folders.php?user=" + Ext.get("username").dom.focus() + "&folder_id=" + this.data.id,
});
folderTreeRoot.appendChild(node);
});
// render the tree
folderTree.render();
folderTreeRoot.expand(false, false);
So I my layout working yesterday and I now understand it better. However, I'm stumped again and need your assistance.
I'm reading from a database obtaining a list of user files and folders. I want to load the top set of files/folders only. Then load subsequent folders when the plus sign is clicked. Reason is, it could be a huge hierarchy and I don't want to load it all at once. So I need a way to:
1. Create a tree and define a root node
2. create a set of folders on the root
3. apply events to the folders so that they are loaded and rendered upon clicking
on the plus sign to expand the hierarchy.
So I've attempted 1 and 2 below. It obviously doesn't work and that's why I'm posting.
As for 3, I have no idea right now how to do that.
Here's what I have for 1 and 2:
folderTree = new Tree.TreePanel('folders', {
animate: true,
enableDD: false,
containerScroll: true
});
// set the root node
folderTreeRoot = new Tree.AsyncTreeNode({
text: '/',
draggable: false,
id: 0
});
folderTree.setRootNode(folderTreeRoot);
foldersDS.each(function() {
var node = new Tree.AsyncTreeNode({
text: this.data.text,
draggable: false,
id: this.data.id,
cls: "leaf",
href: "../php/xdrive_get_user_folders.php?user=" + Ext.get("username").dom.focus() + "&folder_id=" + this.data.id,
});
folderTreeRoot.appendChild(node);
});
// render the tree
folderTree.render();
folderTreeRoot.expand(false, false);