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
}
.....
})
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
}
.....
})