This is a migrated thread and some comments may be shown as answers.
DropDownTree Expand Selected Node
3 Answers 6 Views
This is a migrated thread and some comments may be shown as answers.
Angie
Top achievements
Rank 1
Angie asked on 23 Nov 2020, 08:35 PM
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!

3 Answers, 1 is accepted

Sort by
0
Angie
Top achievements
Rank 1
answered on 24 Nov 2020, 09:18 PM

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;

0
Angie
Top achievements
Rank 1
answered on 25 Nov 2020, 06:15 PM

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();
0
Angie
Top achievements
Rank 1
answered on 25 Nov 2020, 10:02 PM
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. 
Asked by
Angie
Top achievements
Rank 1
Answers by
Angie
Top achievements
Rank 1
Share this question
or