Using TreeGrid (pro) I am finding the drag and drop behavior not to work in an expected manner.
Using setDragBehavior(“complex”), if a node is drag on top of target node, it highlights the target node in red indicating it will become a child if dropped. A line indicates the node will be inserted between the node above and below the line. Fine.
When dropping a node on top of another node, the issue is the node is added as a last child, not a first.
Take for example the following:
A
B
C
D
E
I’d like to move node D to be the first child of A. If I drag D on top of A, D is added as the last child of A i.e.
A
B
C
E
D
I would have expected:
A
D
B
C
E
If I wanted D to be the last child of A, I would have dragged it below E (as a line below E). Given that hovering over A expands its children, I think dropping as ‘first child’ is totally the expected behavior since the user can drop within the children if they want it to be ‘last child’. Alternatively, the default drop position on hover could be configurable.
Using the first example again, trying to move D as the first child of A, I could drag D above B so that there is a line above B and drop it. That however adds D below B. The behavior is probably related to the bug I’m seeing below…
The drag and drop seems to be buggy. Using the initial example:
A
B
C
D
E
If I drag E between B and C, it is sometimes placed between B and C and sometimes between C and D. The only relation I can find seems to be the mouse cursor position in relation to the line while dragging. If the cursor is above the line (and therefore closer to B), it will go between B and C . If the cursor is below the line (and therefore closer to C) it will be dropped between C and D. This seems repeatable. It appears the calculation is not based on the line itself but on the mouse position’s closeness to a node. Is there a fix for this?
Testing was done in both Chrome(Version 33.0.1750.154 m) and Firefox (28.0) (both latest as of today). I am not sure what version number of the TreeGrid pro I’m using. Is there a place to find this?