Drag-n-Drop to root make node disapper

5 posts, 0 answers
  1. Ashish
    Ashish avatar
    3 posts
    Member since:
    Oct 2012

    Posted 02 Dec 2011 Link to this post

    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 :).
  2. Ashish
    Ashish avatar
    3 posts
    Member since:
    Oct 2012

    Posted 02 Dec 2011 Link to this post

    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);
        }
  3. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2527 posts

    Posted 06 Dec 2011 Link to this post

    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!
  4. Ashish
    Ashish avatar
    3 posts
    Member since:
    Oct 2012

    Posted 06 Dec 2011 Link to this post

    Thanks Alex. But isn't this will prevent node to be dropped at bottom of tree?
  5. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2527 posts

    Posted 07 Dec 2011 Link to this post

    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!
Back to Top