This is a migrated thread and some comments may be shown as answers.

Make a Expand/Collapse button for a RadFileExplorer ?

8 Answers 100 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Julie
Top achievements
Rank 1
Julie asked on 17 Apr 2012, 05:10 PM
I try to make a button in order to collapse all nodes of a radFileExplorer.

        function CollapseAll(explorer, b) {
            var nodes = explorer.get_nodes();

            for (var i = 0; i < nodes.get_count(); i++) {
                if (nodes.getNode(i).get_expanded()) {
                    nodes.getNode(i).collapse();
                }
            }
        }

Of course, it doesn't work. How can I access to radFileExplorer items and collapse them ?

Thank you,
Julie

8 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 17 Apr 2012, 06:14 PM
Hi Julie,

RadFileExplorer is using RadTreeView for its TreeView component, and you need to use the RadTreeView client-side API to achieve the required functionality. You can get nodes collection through the treeview's client-side object, e.g.:
<telerik:RadFileExplorer ID="RadFileExplorer1" runat="server">
    <Configuration ViewPaths="~/ROOT" />
</telerik:RadFileExplorer>
<asp:Button Text="text" id="Button1" runat="server" OnClientClick="collapseNodes(); return false;" />
<script type="text/javascript">
    function collapseNodes()
    {
        var explorer = $find("RadFileExplorer1");
        var tree = explorer.get_tree();
        var nodes = tree.get_allNodes();
        nodes.forEach(function (node)
        {
            if (node.get_expanded())
                node.set_expanded(false);
        });
 
    }
</script>


All the best,
Dobromir
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Julie
Top achievements
Rank 1
answered on 18 Apr 2012, 08:28 AM
Thank a lot !
0
PJ
Top achievements
Rank 1
answered on 16 Jun 2013, 01:47 AM
How do you get the expand and collapse nodes in the first place? They only show up if I click on the refresh button.
0
Vessy
Telerik team
answered on 19 Jun 2013, 02:43 PM
Hi PJ,

Could you elaborate more on what exactly do you mean by saying that the nodes "only show up if I click on the refresh button"? By design FileExplorer expands the child nodes of a folder, whenever the folder or the plus sign before it is clicked. Is this behavior the same on your side? Of it is not - could you provide a sample fully runnable project reproducing the problem so we could examine it on our side?

Looking forward to hearing from you,
Veselina Raykova
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
PJ
Top achievements
Rank 1
answered on 19 Jun 2013, 03:34 PM
0
PJ
Top achievements
Rank 1
answered on 19 Jun 2013, 03:36 PM
0
Ivaylo
Telerik team
answered on 24 Jun 2013, 02:44 PM
Hello P J,

The behavior exhibited by you is not the default behavior of the FileExplorer. However, despite our efforts, we have not managed to reproduce it. I am attaching a sample video illustrating the appearance of the control on our side, which is also the expected one. Could you, please, watch it and see if we are missing something when reproducing the problem?

Also, as my colleague has previously suggested, in order to further investigate the issue, we will need a sample project isolating it. Could you, please, prepare one and provide us with more information regarding the control's versions you are using and the browser and its version as well? On a side note, are you able to reproduce the problem in RadFileExplorer's online demo?

Thank you for your cooperation. We will be expecting your feedback.

Regards,
Ivaylo
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
FileExplorer
Asked by
Julie
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Julie
Top achievements
Rank 1
PJ
Top achievements
Rank 1
Vessy
Telerik team
Ivaylo
Telerik team
Share this question
or