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

[Solved] Expand nodes with 1 child

1 Answer 133 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Michael Prosper
Top achievements
Rank 1
Michael Prosper asked on 02 May 2008, 05:08 PM
I have a treeview with multiple root nodes and levels that go about 7 deep.  Some of these nodes only have 1 child node for many levels of the tree.. for example:

Root
   child 1
      grandchild 1
         greatgrandchild1
         greatgrandchild2
         greatgrandchild3
   child 2
      grandchild1
         greatgrandchild1
         greatgrandchild2
         greatgrandchild3
      grandchild2
      grandchild3

The users of my tree have complained that they have to click three times to get access to the "greatgrandchild" nodes: once on "Root", once on "child", and once on "grandchild".

What i want to do is have all child nodes of the selected node automatically expand if they only have 1 child.  In the above example, if a user clicks on "child 1", then "grandchild1" automatically expands to show the greatgrandchildren.  That reduces the number of clicks it take to get to the deepest node.

However, if a user clicks on the "child 2" then the "grandchild" nodes do not expand automatically because there is more than 1 child.

Is there a way I can do this client side?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 05 May 2008, 12:29 PM
Hi Michael Prosper,

I prepared a small and running project for you. Attached, please find the files. Download them and give them a go.

Hope this helps.

Sincerely yours,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
Michael Prosper
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or