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

Drag-n-Drop to root make node disapper

4 Answers 97 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ashish
Top achievements
Rank 1
Ashish asked on 02 Dec 2011, 08:12 PM
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 :).

4 Answers, 1 is accepted

Sort by
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);
    }
0
Alex Gyoshev
Telerik team
answered on 06 Dec 2011, 04:21 PM
Hi Ashish,

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

Thank you for reporting this, it has been fixed for upcoming Kendo UI builds.

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
Alex Gyoshev
Telerik team
answered on 07 Dec 2011, 05:15 PM
Hi Ashish,

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!
Tags
TreeView
Asked by
Ashish
Top achievements
Rank 1
Answers by
Ashish
Top achievements
Rank 1
Alex Gyoshev
Telerik team
Share this question
or