PDA

View Full Version : Drag from grid to grid, then drag-drop re-order help....



josh803316
4 Nov 2009, 9:31 PM
I'm using the drag drop reorder plugin inside of one grid and I'm attempting to drag from another grid to the plugin grid, and then allow the user to drag drop re-order the rows. I'm noticing that my notifyOver method from the plugin and the onContainerOver method from my extended DropZone are firing at the same time with one or the other randomly being called.

Is there a way for me to separate the logic so that when I drag from one grid to another I use the onContainerOver method for the DropZone and when I drag drop for re-order inside the same grid I use the notifyOver from the plugin?

Grid DropZone Extension

jnms.xtypes.grids.flowConfigGridDropZone = function(grid, config) {
this.grid = grid;
jnms.xtypes.grids.flowConfigGridDropZone.superclass.constructor.call(this, grid.view.scroller.dom, config);
};

Ext.extend(jnms.xtypes.grids.flowConfigGridDropZone, Ext.dd.DropZone, {

onContainerOver:function(dd, e, data) {
console.info(dd,e,data);
return dd.grid !== this.grid ? this.dropAllowed : this.dropNotAllowed;
} // eo function onContainerOver

,onContainerDrop:function(dd, e, data) {
if(dd.grid !== this.grid) {
...............
return true
} else {
return false;
}
} // eo function onContainerDrop
,containerScroll:true

});


GRID CONFIG


.....
listeners:{
'render': function(g) {
this.dz = new jnms.xtypes.grids.flowConfigGridDropZone(this, {ddGroup:this.ddGroup || 'templateGridToFlowGrid'});
}
},
enableDragDrop:true,
ddGroup: 'templateGridToFlowGrid',
ddText: 'drag and drop to add',
draggable: true,
viewConfig:{forceFit:true},
loadMask:true,
plugins: [new Ext.ux.dd.GridDragDropRowOrder({
copy: false,
scrollable: true, // enable scrolling support (default is false)
targetCfg: {
ddGroup: 'templateGridToFlowGrid',
copy: false
}
.....
})

jsakalos
5 Nov 2009, 1:19 PM
Is the reorder plugin you mention an ux? If so, the original author will be most able to give you a hand as he knows his plugin best.

josh803316
5 Nov 2009, 1:23 PM
Yes it is a ux. I will try posting the question to him as well.

jay@moduscreate.com
1 Feb 2011, 4:52 PM
I realize that this is an old thread, but you can use any of the examples from Ext JS in Action:

http://extjsinaction.com/examples/chapter14