We are making more & more progress with the native DnD API, and being native means fully taking advantage of Event Bubbling.
In essence this means that if you want to make for example a datatable with a lot of rows without attaching events to them (remember the flyweight pattern?) you’ll only need to set your draggable element at a higher level in the hierarchy to get the DnD behavior applied on all children nodes (marked with the draggable attribute), that’s powerful and of course, reduces a lot the memory footprint of your web application.
A lot of components could benefit of this approach, Treeview, Datatable, Listview and so on.
Another part of the example shows another level of interaction between the browser and desktop, and we are sure this one will get a lot of attention and excitement!
var proxyElement = html.div(null, html.span({ 'cls' : 'dd-proxy-icon' }), html.span('Moo')); var draggableRows = new Swell.Lib.DD.Draggable('bleh', { 'delegate' : true, 'proxy' : true, 'proxyOverride' : proxyElement, 'dataCallback' : function(dt) { var _currentEl = this.getDragEl().current(), _stdOut = []; for(var _n = 0, _l = _currentEl.childNodes.length; _n < _l; _n++) { if(_currentEl.childNodes[_n].nodeType === 1) { var _text = $(_currentEl.childNodes[_n]).text(); _stdOut.push(Swell.Core.trim(_text)); } } this.setData(dt, 'text/plain', _stdOut.join("\t")); } }); var dropTarget = new Swell.Lib.DD.Droppable('moo'); dropTarget.ondrop = function(e, draggable) { if(!!draggable) { draggable.getDragEl().appendTo($('moo').current().tBodies[0]); } }











