JQuery UI drag and drop doesn't notice DOM changes happening during the dragging ?
Posted
by user315677
on Stack Overflow
See other posts from Stack Overflow
or by user315677
Published on 2010-04-13T16:32:33Z
Indexed on
2010/04/13
16:32 UTC
Read the original article
Hit count: 278
Hi everybody,
I have a html table in which each line (<tr>
) represents a group of client computers. Each line can be expanded to show the clients belonging to the group. The <tr>
containing the clients are always generated but hidden and showed when clicking the plus button at the beginning of each line.
The clients themselves (they are <div>
) can be dragged and dropped in another group as long as this group is already expanded. So far it works fine.
What I am trying to achieve now is that the client can be dragged to a collapsed group and after a second or so hovering the group it will be expanded and the client can be dropped amongst the other clients of the group.
I programmed the hover using the in
and out
events of the droppable
and it expands the group all right, but (and now it starts to be hard to explain with words ;) the behavior of the droppable (the client) is still as if the table line that appeared were not there : the in
out
and drop
events of the droppable are fired on the old position of the elements, and the in
out
and drop
events of the newly appeared <tr>
are never fired.
It looks as if JQuery memorizes the position, size etc. of the elements when the drag starts, and these values are not updated if there is a change in the DOM before the drop happens...
Can someone confirm this behavior is normal, or can it be caused by another problem in my own code ? Any workaround ?
(the question is quite bloated already so I don't include any code but I'll gladly upload it if required)
© Stack Overflow or respective owner