DropDownTree Expand Selected Node

4 posts, 0 answers
  1. Angie
    Angie avatar
    120 posts
    Member since:
    Jan 2008

    Posted 23 Nov 2020 Link to this post

    Hello.  I have the DropDownTree set up to display a list of things that can be nested at any level.

    When loading the page, I am able to set the SelectedValue, but I would also like to be able to expand the nodes leading to that selected value so that it is visible to the user when clicking into the control.  I do not want to expand all the nodes, only the nodes relating to the selected value.

    Is there an example for how to do this?  Thank you!
  2. Angie
    Angie avatar
    120 posts
    Member since:
    Jan 2008

    Posted 24 Nov 2020 in reply to Angie Link to this post

    I have answered my own question (this is for server side):

      if (ddtForums.EmbeddedTree.Nodes.FindNodeByValue(forumIDs[i]) != null)
                        ddtForums.EmbeddedTree.Nodes.FindNodeByValue(forumIDs[i]).Expanded = true;

  3. Angie
    Angie avatar
    120 posts
    Member since:
    Jan 2008

    Posted 25 Nov 2020 in reply to Angie Link to this post

    Ok, I was able to get it to work for the server side, but now I'm trying to expand the node on the client side.  

    I can select a toplevel node from the following code, which apparently simulates a click of the node. However, this doesn't seem to work if the node is not at the top level.  So I assume I need to expand the parent node in order to get the child node to be selected?

    nodeparent.expand() throws an error.

    var node = ddtLocations.get_embeddedTree().findNodeByValue(results[1]);
                 node.select();
                 var nodeparent = node.get_parent();
                 nodeparent.expand();
                 var nodeElement = node.get_element();
                 $telerik.$(nodeElement).find("span.rtIn")[0].click();
  4. Angie
    Angie avatar
    120 posts
    Member since:
    Jan 2008

    Posted 25 Nov 2020 in reply to Angie Link to this post

    Nevermind, the problem wasn't selecting the parent node, it was an unrelated issue.  This javascript works, and you don't need the parent stuff. 
Back to Top