If you go to drag-drop demo for treeview and drop any node at root level - it will disappear.
I looked into source and found its bug in dragend event handler. Its looking for adding node at reference destinationNode which in case of root level drop is "undefined".
I am still looking how to resolve this. If I get solution before you do, I will have it posted :).
I looked into source and found its bug in dragend event handler. Its looking for adding node at reference destinationNode which in case of root level drop is "undefined".
I am still looking how to resolve this. If I get solution before you do, I will have it posted :).
4 Answers, 1 is accepted
0
Ashish
Top achievements
Rank 1
answered on 02 Dec 2011, 08:32 PM
Its only happens when you drop node at bottom.
This is what I did to resolve it for now. Need to do more tests though. Also this is not correctly done (as I have used jQuery here). But may be useful as reference.
else if (dropPosition == "before") {
if(!destinationNode || destinationNode.length == 0) {
destinationNode = jQuery(that.treeview.root).children("li").last();
treeview.insertAfter(sourceNode, destinationNode);
}else{
treeview.insertBefore(sourceNode, destinationNode);
}
This is what I did to resolve it for now. Need to do more tests though. Also this is not correctly done (as I have used jQuery here). But may be useful as reference.
else if (dropPosition == "before") {
if(!destinationNode || destinationNode.length == 0) {
destinationNode = jQuery(that.treeview.root).children("li").last();
treeview.insertAfter(sourceNode, destinationNode);
}else{
treeview.insertBefore(sourceNode, destinationNode);
}
0
Hi Ashish,
All the best,
Alex Gyoshev
the Telerik team
A more precise fix would be to add two lines to the TreeViewDragAndDrop.prototype.drag function, around line 850:
if (hoveredItem.length > 0) {
/* 30 lines ... */
} else if (dropTarget[0] != that.dropHint[0]) {
statusClass = "k-denied";
}
All the best,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ashish
Top achievements
Rank 1
answered on 06 Dec 2011, 06:06 PM
Thanks Alex. But isn't this will prevent node to be dropped at bottom of tree?
0
Hi Ashish,
Alex Gyoshev
the Telerik team
No, nodes still can be dropped after the last item. It just happens when users hover the bottom few pixels of the item, rather than placing their cursor at the end of the treeview (i.e. after the item group).
Kind regards,Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!