PDA

View Full Version : Specified Drop Target



f.sauter
20 Dec 2009, 2:49 AM
Hello,

can someone give me an short example how to allow only some specified drop targets for a drag and drop event (tree to tree)? (e.g. if dropTarget instanceof MyModel yes else no). I think the right place is near to TreeDropTarget:onDragX. So where and specially how?

greetings

madhu_g
23 Dec 2009, 4:24 AM
you can make use of setGroup method to restrict the targets. first, invoke setGroup method on your drag source with some value. and then on all the targets you invoke the setGroup method with the same value you provided to the drag source. This will restrict the drop to only targets which have the same group value as the source.

f.sauter
25 Dec 2009, 11:51 AM
Thanks for your answer.

It looks like I can only set the group of the whole tree. Is there a possibility of setting the group for each node individual according their instance?

Edit:
Wrote own solution:

http://www.extjs.com/forum/showthread.php?p=424692

*closed for me*

Arno.Nyhm
28 Dec 2009, 9:49 AM
i think you should look at this code line and i guess it should look like this:



public void removeDropRestriction(Object targetObject){
//this.dropRestrictions.remove(targetObject);
this.dropRestrictions.remove(targetObject.getClass().getName());

}