RadTreeNode expandable but not selectable?

6 posts, 0 answers
  1. Marja
    Marja avatar
    70 posts
    Member since:
    Nov 2013

    Posted 24 Jan 2014 Link to this post

    Hi,

    I use a RadTreeView to display a multi-level tree of news categories with their respective news items.

    I want only the deepest node leveI (being the news item nodes) to be selectable, And so I would like the category nodes to be expandable, but not selectable. 

    Setting the 'enabled' property of a category node to True also blocks its expandability, so that doesn't work for me.

    Can you give me any pointers on how to make a RadTreeNode expandable but not selectable?
    Thanks in advance.

    Best regards, Marja
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 26 Jan 2014 in reply to Marja Link to this post

    Hi Marja,

    Please try the following JavaScript to achieve your scenario.

    JavaScript:
    <script type="text/javascript">
        function pageLoad() {
            var tree = $find("<%=RadTreeView1.ClientID %>");
            tree.findNodeByText("Politics").expand();
        }
    </script>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Marja
    Marja avatar
    70 posts
    Member since:
    Nov 2013

    Posted 27 Jan 2014 in reply to Shinu Link to this post

    Thank you for your reply, but that's not what I'm after. That's only expanding one branch statically, on page load.

    I want the user to be able to expand/collapse tree branches as he pleases, while on the page, but only be able to really select the deepest nodes in the tree.
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 27 Jan 2014 in reply to Marja Link to this post

    Hi Marja,

    Please try the following JavaScript code snippet to select only the deepest nodes in RadTreeView.

    JavaScript:
    <script type="text/javascript">
        function OnClientNodeClicking1(sender, args) {
            var index = args.get_node().get_parent().get_nodes().get_count();
            if (args.get_node().get_parent().get_nodes()._array[index - 1].get_text() != args.get_node().get_text())
                args.set_cancel(true);
        }
    </script>

    Hope this will helps you.
    Thanks,
    Shinu.
  6. Anders
    Anders avatar
    4 posts
    Member since:
    Feb 2016

    Posted 16 Feb Link to this post

    I do not understand why you propose solutions involving scripting. Isnt that just workarounds?
  7. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    287 posts

    Posted 18 Feb Link to this post

    Hi Anders,

    You have posted similar question in another Forum thread (Make node not selectable but expandable). I would suggest you to continue the discussion on this topic there.

    Regards,
    Veselin Tsvetanov
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017