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

Disable In-Between Nodes on Root Only

4 Answers 96 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 2
Joe asked on 22 Jan 2008, 02:27 AM
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

4 Answers, 1 is accepted

Sort by
0
Dimitar Milushev
Telerik team
answered on 25 Jan 2008, 04:16 PM
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
0
Joe
Top achievements
Rank 2
answered on 25 Jan 2008, 04:35 PM
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
0
Dimitar Milushev
Telerik team
answered on 25 Jan 2008, 05:06 PM
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
0
Joe
Top achievements
Rank 2
answered on 25 Jan 2008, 05:15 PM
I am still building so I'll go with the new build.

Thanks for your advise
Tags
TreeView
Asked by
Joe
Top achievements
Rank 2
Answers by
Dimitar Milushev
Telerik team
Joe
Top achievements
Rank 2
Share this question
or