Ticket #3802 (closed bug: fixed)
Draggable: Drag callback not called when using Jquery 1.3b2
| Reported by: | yo-han | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.7 |
| Component: | ui.draggable | Version: | 1.5.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
When I use Jquery-UI with the Jquery 1.3b2 the drag callback is not called. In the code below the alert "hello world" never shows up.
$j('#dragger').draggable({cursor:'move',containment:'#div',appendTo:'#div',drag:function(e,ui){ alert('hello world'); }})
Change History
comment:2 follow-up: ↓ 3 Changed 4 years ago by moiseev
Adding the following code to the ui.draggable.js:
if(this.options[n]) {
this.options[n].apply(this.element, [e, this.uiHash()]);
}
inside propagate method right after '$.ui.plugin.call(this, n, [e, this.uiHash()]);' seems to work fine for me.
comment:3 in reply to: ↑ 2 Changed 4 years ago by moiseev
As far as I understood digging deep into the code - the problem is that the call to 'this.element.triggerHandler' does not use 'this.options[n]' being passed in a last argument as an event handler but only as an event name (see jQuery.triggerHandler and jQuery.trigger). Correct me if I'm wrong. I was also able to get it to work updating the 'init' method in ui.draggable.js appending the following lines to it:
if(o['start']) this.element.bind('dragstart.'+this.widgetName, o['start']);
if(o['stop']) this.element.bind('dragstop.'+this.widgetName, o['stop']);
if(o['drag']) this.element.bind('drag.'+this.widgetName, o['drag']);
BUT! In this case it works significantly slower. PS: The same problem with ui.resizable.js.


I've successfully reproduced the bug with thoses conditions:
The bug could be reproduced with the start, stop and drag methods.