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

Collapse all nodes when filter is empty

3 Answers 96 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Guillaume
Top achievements
Rank 1
Guillaume asked on 05 Nov 2014, 07:03 PM
Hello,

I am using the control to replace a old control we made ourself and that have the same behaviour as this DropDownTree. I have suscceeded yto d pretty much everything I wanted. There is only one thing I want to do, I want all the node to collapse when the filter is empty.
I have tried several solutions, my closest one is this one, but is not working proprely. Sometimes it works, sometimes it does not :

I have attached to the DropDownTree OnClientLoad client side event this function :

function loadTreeView(sender, args) {
var dropdowntree1 = $find("<%=ddtList.ClientID%>");
var tree = dropdowntree1.get_embeddedTree();
$(".rddtFilterInput").keyup(function () {
if ($(".rddtFilterInput").val() == '')
treeCollapseAllNodes(tree);
}
 
I've tryed that too : $(".rddtFilterInput").on('input',function () {...}); But no success either...

I can see that it collapse the nodes but right after they are expanding again. 
I also tried to cancel the OnClientNodeExpanding event when the filter is empty but no success here either...

Do you have any solutions that realize what i'm trying to do ?

Thanks

3 Answers, 1 is accepted

Sort by
0
Guillaume
Top achievements
Rank 1
answered on 05 Nov 2014, 07:05 PM
I realise I miss the implementation of the treeCollapseAllNodes(tree);
So here it is :

function treeCollapseAllNodes(tree) {
    var nodes = tree.get_allNodes();
    for (var i = 0; i < nodes.length; i++) {
        if (nodes[i].get_nodes() != null) {
            if (nodes[i].get_expanded())
                nodes[i].toggle();
                //nodes[i].collapse();
        }
    }
}

0
Guillaume
Top achievements
Rank 1
answered on 10 Nov 2014, 12:49 PM
Bump !! Possible or not ?
0
Boyan Dimitrov
Telerik team
answered on 10 Nov 2014, 03:19 PM
Hello,

Could you please try to use the RadTreeView OnClientNodeExpanded and collapse the node explicitly?

Regards,
Boyan Dimitrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
DropDownTree
Asked by
Guillaume
Top achievements
Rank 1
Answers by
Guillaume
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or