PDA

View Full Version : Drag from tree to grid



msieg
31 May 2007, 8:25 AM
I have a setup identical to the one in the post below where I'm trying to capture a tree node dropping on a grid whose container has been setup as a droptarget. This works perfectly and i'm able to trap the drop of a tree node, however if I try to drag and reorder grid columns the droptarget is also accepting the header fields and breaking the grid column reordering functionality. Anyone help would be greatly appreciated. Thank you in advance.

http://extjs.com/forum/showthread.php?t=6382&highlight=tree+node+drop
grid = new Ext.grid.Grid('eng-grid', {
ds: ds,
cm: cm,
selModel: sm,
loadMask: true,
enableDragDrop:true,
enableColLock:false
});
var drop = new Ext.dd.DropTarget(grid.container, {
ddGroup : 'GridDD',
notifyDrop : function(dd, e, data){
debugger;

for(var i=0; i < data.node.length; i++) {

}
alert('Someone dropped on me!');
}
});

msieg
7 Jun 2007, 9:34 AM
Anyone have any ideas here? Am I posting in the wrong forum?

BernardChhun
7 Jun 2007, 9:53 AM
you can check the dragged object type in the beforeNodeDrop event if I recall. if it's something else than a grid's line then make sure e.cancel is equal to true:


Tree.on('beforenodedrop', function(e){
// checkout what is in the e param
/* ... */
e.cancel = true;
});

msieg
7 Jun 2007, 10:03 AM
thanks for replying. Unless I'm wrong, i think that would solve another issue.

The problem i'm having is: When i drag column headers (to reorder columns) the drop zone is recognizing the columns as an accepted group. So when i drag a column over the grid (any arear, it breaks the existing built in grid column drag and drop functionality.

Any other help would be greatly appreciated.