Hi,
I have a grid based on my 'File' model and I'm trying to drag the rows into a tree based on my 'Folder' model. So the grid is set up and then:
new GridDragSource(_fileGrid);
is ran.
The tree is set up and then:
final TreePanelDropTarget target = new TreePanelDropTarget(_folderTree);
target.setAllowDropOnLeaf(true);
target.addDNDListener(some_listener);
is ran.

I don't want gxt to try and help me update the grid or tree or the associated models, they are different types and a casting exception is thrown. I just want to use a DNDListener to listen to the dragDrop event and use my own code to update everything. How can I turn off everything except for the event? I've tried target.setOperation(null); and it doesn't work.

Thank you for your time.

sven

13 Dec 2010, 11:01 AM

How can I turn off everything except for the event?

Dont use the TreePanelDropTarget than but use your own DropTarget class.

What kind of exception do you have now? What are you doing exactly? Do you have a testcase implementing EntryPoint of what you are doing?

grp500

13 Dec 2010, 11:06 AM

Great! That seems to be a very good start! Thanks for the prompt reply!

sven

13 Dec 2010, 11:07 AM

DropTarget still has all the events, just no logic. So it should be exactly what you use.

vbjain

8 Oct 2011, 11:16 PM

Can you tell me how exactly you solve this? I am also having same kind of requirement where Tree will have different model and Grid will have different model. When i drag from Grid to Tree the dragged model should updated to the Tree compatible model.

I have override the TreePanelDropTarget but dont know exactly which methods to override for this requirement.

Thanks.

guresha

1 Oct 2014, 11:37 PM

You must create your own DropTargetClass, like

public class CustomGridDropTarget extends DropTarget

. Then you must implement all methods, which are implemeted in
GridDropTarget
all methods copy/paste.
One, there the method
protected void onDragDrop(DndDropEvent e) and
private int adjustIndex(DndDragMoveEvent event, int index). they call superclass method
prepareData. You must write your own
convertData method, where you take drag types of modela and convert it to drop type of models.
there is a code:

. finaly, all you must to do is:
1.copy entire implementation of
GridDropTarget
2. remove
prepareData.
and write your
convertData

vannguchau

26 Oct 2014, 6:30 PM

You must create your own DropTargetClass, like

public class CustomGridDropTarget extends DropTarget

. Then you must implement all methods, which are implemeted in
GridDropTarget
all methods copy/paste.
One, there the method
protected void onDragDrop(DndDropEvent e) and
private int adjustIndex(DndDragMoveEvent event, int index). they call superclass method
prepareData. You must write your own
convertData method, where you take drag types of modela and convert it to drop type of models.
there is a code: