Disable In-Between Nodes on Root Only

5 posts, 0 answers
  1. Joe Hakooz
    Joe Hakooz avatar
    65 posts
    Member since:
    Dec 2007

    Posted 21 Jan 2008 Link to this post

    First, thanks for all the help so far. I've almost got my treeview working exactly how I imagined. Only one, I hope, challenge remaining...

    This is what my treeview looks like (One Root Item)

    Home
    ---About Us
    --------Contact Us
    ---Solutions
    ---Services
    ---Etc

    Using client-side only, I can drag items between nodes displaying the dotted line (rtDropAbove or rtDropBelow). The problem is that I would like to either "hide" or disable the dotted line when it's above or below Home (Root Node). I've already disabled the drop in-between functionality in that situation, I just need to hide the dotted line.

    Is there any way to do this using client-side or CSS?

    Here is my code so far. The root node always has a get_value() of 1, which may be the key to my problem.
    ------------------------
    <script type="text/javascript">       
       
        function clientSideEdit(sender, args)
        {
            var destinationNode = args.get_destNode();
            if(destinationNode)
            {
                var firstTreeView = $find('rtv');
                firstTreeView.trackChanges();
                var sourceNodes = args.get_sourceNodes();
                for (var i = 0; i < sourceNodes.length; i++)
                {
                    var sourceNode = sourceNodes[i];
                    sourceNode.get_parent().get_nodes().remove(sourceNode);
                    if(args.get_dropPosition() == "over") destinationNode.get_nodes().add(sourceNode);
                    if(args.get_dropPosition() == "above")  insertBefore(destinationNode, sourceNode);
                    if(args.get_dropPosition() == "below")  insertAfter(destinationNode, sourceNode);
                }
                destinationNode.set_expanded(true);
                firstTreeView.commitChanges();
            }
        }
       
        function insertBefore(destinationNode, sourceNode)
        {
            var destinationParent = destinationNode.get_parent();
            var index = destinationParent.get_nodes().indexOf(destinationNode);
            destinationParent.get_nodes().insert(index, sourceNode);
        }
       
        function insertAfter(destinationNode, sourceNode)
        {
            var destinationParent = destinationNode.get_parent();
            var index = destinationParent.get_nodes().indexOf(destinationNode);
            destinationParent.get_nodes().insert(index+1, sourceNode);
        }
       
        function onNodeDropping(sender, args)
        {
            var dest = args.get_destNode();
            if (dest)
            {
                if (dest.get_value() != 1 || args.get_dropPosition() == "over")
                {
                    clientSideEdit(sender, args);
                }
                args.set_cancel(true);
                return;
            }
        }

      </script>
    ------------------------

    Please let me know if I need to elaborate.
    Thanks,
    Joe

  2. Dimitar Milushev
    Admin
    Dimitar Milushev avatar
    555 posts

    Posted 25 Jan 2008 Link to this post

    Hi Joe Hakooz,

    Please excuse us for the late answer.

    There is no easy way to achieve this in the current version of the control, but we have implemented such functionality in the latests build. If you would like, you can open a support ticket and we will send you the latests build of the Prometheus suite.

    Kind regards,
    Dimitar Milushev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Joe Hakooz
    Joe Hakooz avatar
    65 posts
    Member since:
    Dec 2007

    Posted 25 Jan 2008 Link to this post

    Thanks Dimitar,
    Is the new build ready to rock, or should I wait for the official release? It's not critical that I have that functionality so I can wait based on your recommendation.

    Joe
  5. Dimitar Milushev
    Admin
    Dimitar Milushev avatar
    555 posts

    Posted 25 Jan 2008 Link to this post

    Hi Joe Hakooz,

    If are still developing your application, you can try the new build as we strive to keep builds as stable as possible. For live applications we recommend using official versions only. 

    All the best,
    Dimitar Milushev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Joe Hakooz
    Joe Hakooz avatar
    65 posts
    Member since:
    Dec 2007

    Posted 25 Jan 2008 Link to this post

    I am still building so I'll go with the new build.

    Thanks for your advise
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017