Hello.
I have a root folder that has 7 child node folders. Instead of making each child a root within the server-side code, I'd like to keep the structure I have but open the child folder of the root based on a querystring path variable. Is this possible? I've read you can use treeNode.childNodes[x].select() but I don't know how to derive the index of the node within the js or server-side code. I'd prefer server-side if you have a sample.
Thanks.
sapa IT
11/29/2009 9:50 PM
Yes, this can be possible but you need to combine server and client side code.
Open FileVista\FileVistaControl\scripts\filevista.js and find these lines:
if (treeNodeFirstLoad) {
treeNode.sortChildren();
treeNode.loadChildren();
}
Add this line in this if block:
if (treeNodeFirstLoad) {
treeNode.sortChildren();
treeNode.loadChildren();
if (treeNode.parent == tree.root)
tree.selectNode(currentFolder.rootFolderID, "Some subfolder");
}
Now, FileVista will select the subfolder of the root folder which is named "Some subfolder" on load.
You need to pass your querystring path value somehow in place of this parameter.
I recommend you to include a hidden field in your page:
<input type="hidden" name="folderToSelect" value="<%=Request.QueryString["path"]%>" />
Then you can access the querystring from javascript with document.getElementById("folderToSelect").value
So the final code will be
if (treeNodeFirstLoad) {
treeNode.sortChildren();
treeNode.loadChildren();
if (treeNode.parent == tree.root)
tree.selectNode(currentFolder.rootFolderID, document.getElementById("folderToSelect").value);
}
Let me know.
Cem Alacayir
1/15/2010 4:39 PM