How to refresh the drop.data Array (jquery.event.drop-1.2)

19 views
Skip to first unread message

Sebastian Proksch

unread,
Dec 3, 2009, 5:14:18 PM12/3/09
to threedubmedia
Hi,

thank you for this great jQuery plugin! I already used it in a bunch
of applications, I'm very astonished how easy it is to get drag&drop
working with this plugin.

Unfortunately at the moment I'm stuck with a caching problem.

Imagine two Lists A + B, placed B below A. I'm able to drag&drop the
list elements between both lists (in both ways). Sidenote: If a list
element is moved from one list to the other, the dimensions of both
lists change (because the number of items differs), and the location
of List B changes too (because A changes in length). So far everything
is alright.

The problem is, after that move, the "drop hovering" is still the same
(with respect to screen location), as if the lists were not changed.

As far as I understand the sourcecode, location and dimension from all
drop targets are set (and cached) in drop.data, when you ".bind()"
them. Obviously these locations never get updated for me, so my
question is, how can I update them manually? As a quick-fix I changed
the "tolerate" method in the "drop"-plugin:

> do if ( drp = drop.locate(drop.$targets[i]) ){
---
< do if ( drp = drop.data[i] ){

So basically, I simply skipped the cache. How can I refresh the
"drop.data", so that I can reenable the cache?

best regards
Sebastian

Plugin-Version: jquery.event.drop-1.2.js
Browser: FF3.5.5, but reproducible in Safari 4.0.4

3wme

unread,
Dec 4, 2009, 11:41:17 AM12/4/09
to threedubmedia
There is a utility function ($.dropManage) that re-caches the drop
target positions. The most likely place to use this is inside the
"dragstart" handler. This is will happen automatically in the next
release of this plugin.

http://groups.google.com/group/threedubmedia/msg/c872ab84a365ceb2?hl=en
Reply all
Reply to author
Forward
0 new messages