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;
}
}
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