View Full Version : set gridpanel DDgroup

29 Jun 2008, 7:42 PM
Is there a way to change a gridPanel's DDgroup once it has been set, like a setDDGroup

I am doing drag and drop between 1 source grid to N number of target grids.
I have implemented the 1 source to 1 target by hardcoding the ddGroup on the source grid.

To complete the 1 to N drag drop I was thinking of adding a mouseOver event on the target gridPanels to change the DDgroup to be the mouseOvered target.

Is this possible or is there a better way to do this?


29 Jun 2008, 7:51 PM
From the source in GridView.js

if(g.enableDragDrop || g.enableDrag){
this.dragZone = new Ext.grid.GridDragZone(g, {
ddGroup : g.ddGroup || 'GridDD'

You should be able to do something like:

grid.getView().dragZone.ddGroup = 'foo';

I have no idea whether this will have any side effect though.

29 Jun 2008, 8:46 PM
I have not been able to try out your solution yet.
grid.getView().dragZone.ddGroup = 'foo';

I ran into a different issue related to the MouseOver.

the MouseOver returns an eventObject, and from that eventObject I need to get the Id of the mouseOvered gridPanel.

how do I get the id from the event?

function handleGridPanelMOEvent(e){
var target = e.getRelatedTarget();
i also tried target = e.getTarget();
and target = e.getTarget(null, null, true);
id = target.getId(); //always gives error "target.getId is not a function"

all 3 getTargets are not returning the gridPanel.
sorry for the dumb questions. I'm new to extJS.

1 Jul 2008, 6:15 PM
This didn't work.

grid.getView().dragZone.ddGroup = 'foo';

if I hardcode the ddGroup to "foo" when initializing the gridPanel, the drag drop works.

If I set the ddGroup to "foo" using your suggestion, the drag drop doesn't work.
After setting the ddGroup, if I alert(grid.getView().dragZone.ddGroup) it alerts "foo" so the property appears to be set, but the drag drop doesnt work.

any ideas?

1 Jul 2008, 6:32 PM
Am I taking an entirely wrong approach?
Is there another way to drag to multiple targets without having to change the ddGroup everytime i mouseOver the target?

i'm open other approaches.


1 Jul 2008, 6:32 PM


5 Nov 2008, 10:31 PM
Ultimately I'm trying to change the ddGroup of 'listPanel'. According to my interpration of the docs linked to by evant in the post above, the following code should create listPanel with a ddGroup of 'listing', then also add it to the 'site' ddGroup, however firebug complains that listPanel.dd doesn't exist. The GridPanel API suggests that if I configure listPanel as dragable (which it is), it should have a public property of 'dd', which it doesn't appear to. Any ideas as to what I'm doing wrong?

var listPanel = new Ext.grid.GridPanel({
store: helperStore,
ddGroup: 'listing',
dragable: true,
enableDragDrop: true,
columns: [
{header: 'Site', width: '210', sortable: true, dataIndex: 'name'}


...the reason I'm trying to do this is that I have a form down the left hand side with the grid on the right. I have code in the focus event for each form field that updates the grid with valid values for that particular field. It is at this point I'd like to change the ddGroup of the GridPanel so that the user can drag a value from the field to the currently selected field (each field has a DropTarget with a unique group).

One work around is to delete the GridPanel and re-create it on each focus event with the desired ddGroup, however I don't think that is a very elegant way to achieve the desired result.