Ticket #6285 (assigned enhancement)
low level drag and drop as easy as scriptaculous
| Reported by: | harobed | Owned by: | elazutkin |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.2 |
| Component: | DnD | Version: | 1.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description (last modified by elazutkin) (diff)
Hi,
sometimes dojo.dnd mechanism is overkill for my need and I would like use something like scriptaculous drag and drop mechanism.
In Scriptaculous, to perform drag and drop you need two things :
- Draggable objet
- Droppable.add method
Example :
var drag = new Draggable(
'id_of_draggable_element', {
revert: true, ghosting: true, onEnd: function() {
console.log("draggable end");
}
}
);
Droppable.add(
'id_of_droppable_element', {
onHover: function(draggable_element, droppable_element) {
console.log(draggable_element); console.log(droppable_element);
}, onDrop: function(draggable_element, droppable_element, event)
{
console.log(draggable_element); console.log(droppable_element); console.log(event);
}
}
);
I think this is lower level than dojo.dnd mechanism.
Few month ago, I've spoke about it in mailing list : http://thread.gmane.org/gmane.comp.web.dojo.user/31296/focus=31297
I've suggested to develop this feature. I do it. See my patch.
Note : this patch need dojo.within function proposed in http://trac.dojotoolkit.org/ticket/6284
Soon, I'll write small documentation about this new feature.
Regards, Stephane