Collapse all nodes when filter is empty

4 posts, 0 answers
  1. Guillaume
    Guillaume avatar
    15 posts
    Member since:
    Oct 2010

    Posted 05 Nov 2014 Link to this post

    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
  2. Guillaume
    Guillaume avatar
    15 posts
    Member since:
    Oct 2010

    Posted 05 Nov 2014 Link to this post

    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();
            }
        }
    }

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Guillaume
    Guillaume avatar
    15 posts
    Member since:
    Oct 2010

    Posted 10 Nov 2014 Link to this post

    Bump !! Possible or not ?
  5. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 10 Nov 2014 Link to this post

    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.

     
Back to Top