This question is locked. New answers and comments are not allowed.
Hi :)
I am having a bit of an issue with the TreeView draggable nodes.
I have a treeView that looks like the attached image.
I can drag and drop the different nodes where I please.
I don't want to be able to drag anything inline with the "Home" category, but I do want to be able to drag it to be the child...
I added this code:
which stops me putting any nodes next to the "Home" node, but it also stops me being able to add any children.
Could someone please let me know how to add child nodes to the "Home" node, but disable dragging nodes to it's level?
Cheers,
/Jaymie
I am having a bit of an issue with the TreeView draggable nodes.
I have a treeView that looks like the attached image.
I can drag and drop the different nodes where I please.
I don't want to be able to drag anything inline with the "Home" category, but I do want to be able to drag it to be the child...
I added this code:
function onNodeDrop(e) { var dropContainer = $(e.dropTarget).closest('.drop-container'); var treeview = $('#TreeView').data('tTreeView'); var parentId = treeview.getItemValue(e.destinationItem); var firstNodeElement = treeview.getItemValue($("li:first", treeview.element)[0]); var nodeText = treeview.getItemText(e.item); if (parentId == firstNodeElement) { e.preventDefault(); } if (dropContainer.length > 0 && dropContainer[0].innerHTML.indexOf(nodeText) == -1) { $('<div><strong>' + nodeText + '</strong></div>') .hide().appendTo(dropContainer).slideDown('fast'); e.preventDefault(); }}which stops me putting any nodes next to the "Home" node, but it also stops me being able to add any children.
Could someone please let me know how to add child nodes to the "Home" node, but disable dragging nodes to it's level?
Cheers,
/Jaymie