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

Select Only One Child Node

4 Answers 68 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kishor Dalwadi
Top achievements
Rank 2
Kishor Dalwadi asked on 11 Aug 2010, 09:27 AM
Hello Sir,

I am Using RadTree.

My requirement is like I want only select one child node in tree in backend side.

Please Give me proper solution.

Thanks.

Kishor Dalwadi

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 11 Aug 2010, 10:43 AM
Hi,


I am not quite sure about the requirement. But if you want to select a single node at a time, then set the "MultipleSelect" property of RadTreeview to false.


-Shinu.
0
Kishor Dalwadi
Top achievements
Rank 2
answered on 11 Aug 2010, 10:54 AM
Hello Shinu

Thanks for Reply.

Actually I Want Node Selection Like RadioButton and Parent Node is not selectable by User.

So Child Nodes are Only Selectable in tree.

Thanks

Kishor Dalwadi.
0
Veronica
Telerik team
answered on 12 Aug 2010, 05:04 PM
Hello Kishor Dalwadi,

By default you can select only one node at a time in the RadTreeView.
 
Could you please explain more on: "Parent Node is not selectable by User"?

If you want to be able to select only leaf nodes (nodes that don't have children) you'll need to subcribe to the OnClientNodeClicking event and use the following code in the handler:

function clientNodeClicking(sender, args) {
            var tree = $find("<%= RadTreeView1.ClientID %>");
            for (var i = 0; i < tree.get_allNodes().length; i++) {
                if (args.get_node().get_nodes().get_count() == 0) {
                    args.set_cancel(true);
                }
            }
        }

Greetings,
Veronica Milcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ron
Top achievements
Rank 1
Veteran
answered on 26 Jan 2011, 03:25 PM
Shouldn't this simply be:

function clientNodeClicking(sender, args) {
      if (args.get_node().get_nodes().get_count() > 0) {
           args.set_cancel(true);
      }
}
Tags
TreeView
Asked by
Kishor Dalwadi
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 1
Kishor Dalwadi
Top achievements
Rank 2
Veronica
Telerik team
Ron
Top achievements
Rank 1
Veteran
Share this question
or