I recently just got an ExtJS Drag and Drop from a Grid to a BoxComponent to work. The problem with all the examples online was that it didn't have any object oriented fashion of creating a Drag and Drop sequence. All of them were just creating variables sequentially to build the the drag and drop functionality. So what happened was that the container with the DropTarget object needed to have a reference of the RowSelectionModel from the Grid. This makes it difficult to implement object-oriented concepts. Also there's this obscure 'data' object that gets passed into a event function such as notifyDrop() as below.
var dd = new Ext.dd.DropTarget(this.el.dom, { // must be same as for tree ddGroup:'tl' // what to do when user drops a node here ,notifyDrop:function(dd, e, data) { alert(data.selections[0].data['ACID']); return true; } // eo function notifyDrop });
"What the hell is this data object?" The ExtJS documentation doesn't have any clear place where it is and what it's about. But apparently it has an array 'selections' which then contains an array with the data that was selected. I was able to find out how to use it by scurrying forums everywhere. Why can't the documentation clearly state what this object is all about instead of just
data : Object An object containing arbitrary data supplied by the drag source
Thank you Sencha that's very clear!
Comments