Have only leaves selectable

4 posts, 0 answers
  1. robert
    robert avatar
    4 posts
    Member since:
    Oct 2011

    Posted 02 May 2013 Link to this post

    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!
  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 07 May 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. robert
    robert avatar
    4 posts
    Member since:
    Oct 2011

    Posted 08 May 2013 Link to this post

    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.
  5. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 14 May 2013 Link to this post

    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.
Back to Top