Hi. I have a RadFileExplorer and I would like to expand all of the nodes in its RadTreeView in the left hand panel on page load.
I have tried numerous ways in the code behind as well as JavaScript. The best I could manage was to expand the first node, but nothing more.
I appreciate any suggestions.
Thanks.
Hi Evan,
The following JS solution, based on this article, expands all tree nodes on my side:
<telerik:RadFileExplorer ID="RadFileExplorer1" runat="server" OnClientLoad="OnClientLoad"> <Configuration ViewPaths="~/Images" UploadPaths="~/Images" /> </telerik:RadFileExplorer> <script> function OnClientLoad(sender, args) { treeExpandAllNodes(sender) } function treeExpandAllNodes(sender) { var treeView = sender.get_tree() var nodes = treeView.get_allNodes(); for (var i = 0; i < nodes.length; i++) { if (nodes[i].get_nodes() != null) { nodes[i].expand(); } } } </script>
Hi Rumen,
Thanks, this is what I have already tried unsuccessfully.
What I have found is that nodes will only expand up to 3 directories deep in your file system.
e.g. if you had this folder structure...
~/Images/Folder1/Folder2/Folder3/Folder4/Folder5
The Images, Folder1 and Folder2 nodes / directories will be expanded on load, but you will have to manually expand the rest of the child directories i.e expand Folder2 to see Folder3, and so on.
In my application, I need to expand all child directories.
Thank you very much Rumen, this is the answer I've been searching for!
I can confirm this now works inside my RadFileExplorer to expand all sub nodes perfectly.
I really appreciate your help :)