Select only child (leaf) nodes

5 posts, 0 answers
  1. Jay
    Jay avatar
    89 posts
    Member since:
    Nov 2007

    Posted 23 Oct 2008 Link to this post

    How would I implement a treeview where a user could only select nodes at the tip of the tree (i.e. "leaves")?  I've tried "rtn.Enabled = false;", "rtn.PostBack = false;" (since I embedded the RadTreeView in a RadComboBox control), and "rtn.Checkable = false;" for the RadTreeNode, all which provide part of the functionality I need, but either provide too much ("Enabled = false" makes it so I can't select the node, but then I can't expand the node, either), or not enough ("Checkable = false" doesn't apply when I haven't added checkboxes).  Did I miss a setting for this?
  2. Jay
    Jay avatar
    89 posts
    Member since:
    Nov 2007

    Posted 23 Oct 2008 Link to this post

    I also searched in case the RadTreeView control had a setting, but couldn't find one.
  3. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 24 Oct 2008 Link to this post

    Hello Jay,

    What you need to do is subscribe to the OnClientNodeClicking event of the treeview and cancel it if the clicked node has children (if (node.get_nodes().get_count() > 0)

    I hope this helps.

    Kind regards,
    Veselin Vasilev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  4. Jay
    Jay avatar
    89 posts
    Member since:
    Nov 2007

    Posted 24 Oct 2008 Link to this post

    Thanks, that does help.

    But to work alongside that, how do I prevent the RadComboBox from closing when I select that invalid entry?  Do I need to overwrite the RadComboBox's OnClientDropDownClosing handler or do I have another option?
  5. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 27 Oct 2008 Link to this post

    Hello Jay,

    You need to wrap the treeview in a div and cancel bubbling when clicking in the div. You can check our online example for the implementation.

    Best wishes,
    Veselin Vasilev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top