View Full Version : How to enable dropping a row on only some rows in a Grid

15 Mar 2012, 12:31 AM
Hi all,

I have a Grid supporting dragging/dropping through using the griddragdrop plugin. My question is how I can do to limit the dropping (that means just dropping on some rows, not all of rows)?


15 Mar 2012, 1:17 AM
You could create a dropzone on the grids view (new Ext.dd.DropZone) and disable drop in the gridviewdragdrop plugin, in case you use that.

So set enableDrop to false on the view and create a dropZone instead.

In the config of the DropZone you set the onNodeOver function onNodeOver

onNodeOver : function(target, dd, e, data){

return Ext.dd.DropZone.prototype.dropAllowed;


In the situation above all drops are allowed, but you could modify that with the data and give conditioned a dropNotAllowed.

15 Mar 2012, 2:02 AM
Thanks for your answer. To give you a clear view on what I am doing, I took a screenshot and uploaded here.
The tree structure in the image is actually a Grid component because I do not see any examples about trees giving me an idea. Now, I can handle the case that if a parent node is selected then all of its child nodes are selected as well. However, as I described above I got a problem when implementing the drag/drop feature on the Grid. It just allows dragging a node and dropping it to nodes in the same parent.
I had a look at the extjs code to see what they did in the griddragdrop plugin. It also brought to me some ideas like you suggested override the onNodeOver method. However, I am stuck in getting the record data from the target and dragging source because I stored the info for checking allowed or 'not allowed' there.32745

15 Mar 2012, 2:04 AM
That target you have as input in the onNodeOver event. Just firebug what you get in there.

15 Mar 2012, 2:07 AM
What about the dragged row? How can I get its record info?

15 Mar 2012, 2:10 AM
Its somewhere in the dd or the data as well