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

Have only leaves selectable

3 Answers 141 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
robert
Top achievements
Rank 1
robert asked on 02 May 2013, 03:17 PM
I wonder if you will eventually add a feature to allow node selecting only on leaf elements? Or if you have a quick way to implement it in the current version of the control.

Thank you!

3 Answers, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 07 May 2013, 01:09 PM
Hi Robert,

Thank you for contacting us.

I would suggest that you refer to the following demo of the RadDropDownTree control that I believe implements the functionality that you describe - DropDownTree Image Preview. Please give it a try and let me know if this complies with the functionality that you are trying to achieve.

Regards,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
robert
Top achievements
Rank 1
answered on 08 May 2013, 06:58 PM
Hi, thank you for your reply.

The functionality in the demo you linked to is a bit like what i'm looking for. As i see in the code it's possible to check what the level of the current node is and display checkboxes or not.

However, i do not simply want to hide checkboxes on the root (0) level. My tree has multiple levels similar to  :

(those with 'X' are the leaves i would like to be selectable)
Root 1
- Node 1.1 X
- Node 1.2
-- Node 1.2.1
-- Node 1.2.2
--- Node 1.2.2.1 X
Root 2
- Node 2.1
-- Node 2.1.1 X
- Node 2.2 X

In a similar way to checking the level of the node, it would be nice to have a boolean property like HasChildren or IsLeaf on the node.

Of course, i could search in my collection everytime to check if any element has DataParentId equal to the value of the current node, but it doesn't seem very efficient.
0
Kate
Telerik team
answered on 14 May 2013, 01:04 PM
Hello Robert,

You can set checkboxes to the needed nodes in the dropdown depending on your criteria. For instance if you set different values, you can check by the value of the node and set checkboxes when needed. In the demo that I recommended in my previous post, we use the Level property for that criteria but after looking at the example that you provided it would be better to use a different property (that could be the Value for example) . 

All the best,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
DropDownTree
Asked by
robert
Top achievements
Rank 1
Answers by
Kate
Telerik team
robert
Top achievements
Rank 1
Share this question
or