Bug Tracker

Opened 12 years ago

Closed 9 years ago

#2063 closed enhancement (invalid)

Droppable accept function improvement

Reported by: mnichols Owned by: rworth
Priority: major Milestone: 1.2.2
Component: ui Version: 1.2.1
Keywords: Cc:
Blocked by: Blocking:

Description

I am commonly needing to get the droppable element being targeted during an 'accept' callback to determine if the draggable signature is acceptable against the droppable element. There isn't an easy way to get the droppable instance during this callback, so I changed draggable and droppable to use 'call' while passing in the droppable instance to force 'this' to always be the droppable being targeted during the accept callback. Really, the 'ui' object should be getting passed in to this callback just like the other options to be consistent. Please see attached patches or consider changing the method signature of this callback ... the function callback seems to have been an afterthought.

Attachments (4)

uidraggable121607.patch (1.2 KB) - added by mnichols 12 years ago.
Draggable using 'call' for accept callback
uidroppable121607.patch (2.2 KB) - added by mnichols 12 years ago.
Droppable invoking using 'call' on accept callback
uidroppable-pass.ui.to.accept.patch (2.4 KB) - added by mnichols 12 years ago.
Patch successfully passes ui to the accept function of droppable
droppable.accept.this.patch (691 bytes) - added by m0n5t3r 12 years ago.
droppable accept hack

Download all attachments as: .zip

Change History (13)

Changed 12 years ago by mnichols

Attachment: uidraggable121607.patch added

Draggable using 'call' for accept callback

Changed 12 years ago by mnichols

Attachment: uidroppable121607.patch added

Droppable invoking using 'call' on accept callback

comment:1 Changed 12 years ago by mnichols

My draggable patch has a small error...it is passing the draggable instead of the draggable.element as other parts do. Really, the documentation is wrong when it says that the draggable is passed to the accept callback since in fact the draggable.element is being passed.

comment:2 Changed 12 years ago by rworth

Owner: set to rworth
Status: newassigned

Changed 12 years ago by mnichols

Patch successfully passes ui to the accept function of droppable

comment:3 Changed 12 years ago by mnichols

Due to the complete rewrite of droppables recently, the first two patches are stale. I have created a new patch that allows passing the 'ui' object from droppable into the accept function. This gives developer better options for determining if an draggable should be accepted based on criteria found in the target droppable.

Please see attached ' uidroppable-pass.ui.to.accept.patch ' and disregard the previous patches....

Mike

comment:4 Changed 12 years ago by mnichols

I submitted #2122 that has this patch and a fix to the most recent trunk. I'd recommend disregarding this patch to get the fix.

Mike

Changed 12 years ago by m0n5t3r

Attachment: droppable.accept.this.patch added

droppable accept hack

comment:5 Changed 12 years ago by m0n5t3r

I think the above patch is a more elegant approach to passing the ui object as this to the accept function

comment:6 Changed 12 years ago by mnichols

does this work on the rewrite that was done on the trunk?

comment:7 Changed 12 years ago by m0n5t3r

it's made against r4501, should apply cleanly to current trunk (the changes that have occurred since then are fn API changes, the ui part is unchanged)

comment:8 Changed 12 years ago by mnichols

If I understand your patch, it seems your patch is passing the droppable (not ui) to be this . The patch I submitted in #2122 passes the ui object as an arg the same as the other method calls. This is more intuitive I think than requiring the dev to back into the ui object thru this.

comment:11 Changed 9 years ago by Rick Waldron

Resolution: invalid
Status: assignedclosed

UI bugs should be reported to: http://dev.jqueryui.com/

Note: See TracTickets for help on using tickets.