How to determine DropPosition *before* dropping

2 posts, 0 answers
  1. Sebastian P.R. Gingter
    Sebastian P.R. Gingter avatar
    7 posts
    Member since:
    Jun 2010

    Posted 30 Dec 2010 Link to this post

    Hi,

    I need the dropPosition (like I could request in the nodeDropping event from the eventArgs) already in the nodeDragging event.

    The issue is that I can sort nodes within the tree (drag them in between) and certain nodes (determined by an attribute value) may be moved everywhere BUT to the first position (under certain parent nodes with the same attribute value).

    I could simply cancel the dropping event - but that would confuse the user: All other checks are done in nodeDragging and if the drop target is invalid the not-allowed cursor style is displayed. This should also be the case when this certain node type is dragged directly under the certain parent nodes if this has no other children or above the first child of these parents.

    So how can I determine the current dropPosition in the dragging event?
  2. Sebastian P.R. Gingter
    Sebastian P.R. Gingter avatar
    7 posts
    Member since:
    Jun 2010

    Posted 30 Dec 2010 Link to this post

    Got it myself.
    The treeview holds this information in it's inner state:

    var tree = this.get_navigationTree();
    var e = args.get_domEvent();
     
    // determine target node and position from underlying tree:
    var destinationNode = (e.target == tree._dropClue)
       ? tree._dropClue.treeNode
       : tree._extractNodeFromDomElement(e.target);
     
    var position = tree._draggingPosition;

    I just hope that this internal implementation doesn't change on some updates.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top