PDA

View Full Version : notifyDrop called twice on nested DropTarget



chris-mac
8 Sep 2009, 1:43 AM
Hi,

I have Panel and a Window on top of it. Both are DropTargets for two different ddGroups. When I drop tree node (which belongs to both ddGroups) on a Window, notifyDrop is called twice.

Is there any simple fix this, so Window's notifyDrop will be called only once?

Code and working example can be found at http://extjs.wima.co.uk/example/18

Thanks
Chris

8 Sep 2009, 3:46 AM
It works for me as expected pasting the following code:




var dropZone2 = {
border: false,
bodyStyle: 'padding: 20px; font-size: 16px; color: #ff0000;',
html: 'Drop zone 2 - new',
listeners: {
render: function(panel){

var dropTarget = new Ext.dd.DropTarget(panel.body,{
ddGroup: 'dropGroup2',
copy: false,
overClass: 'over',
notifyDrop: function(dragSource, event, data){
console.info('notifyDrop');
Ext.fly(panel.getEl()).frame("ff0000");
}
});
}
}
};

var win = new Ext.Window({
title : 'meh',
width: 150,
height: 150,
closable: false,
resizable: false,
title: 'Window',
layout: 'fit',
items: dropZone2
}).show()





I have just finished two chapters regarding drag and drop and have never seen this issue.

chris-mac
8 Sep 2009, 4:12 AM
Thanks for your reply.

I modified my code as per your suggestion, it is available here (http://extjs.wima.co.uk/example/18a).

Unfortunately this didn't fix my issue. When Window is positioned outside "Drop zone 1" indeed notifyDrop is called only once. However when Window is moved over "Drop zone 1" notifyDrop is called twice.

Please see screen shoot attached.

8 Sep 2009, 5:00 AM
Yeah, i think this is a bug with the drop target detection.

To clear things up, please don't call it a "DropZone". You should call it something else if you're not using the DropZone class.

What version of Ext JS are you using?

8 Sep 2009, 5:02 AM
Also, use highlight instead of frame. :)


Want to see somehting cool? Stack two or three of the windows with the drop target config on top of each other.

8 Sep 2009, 5:05 AM
I'm going to do some troubleshooting in the lower level classes (ancient).

8 Sep 2009, 5:13 AM
Just verified this issue with one of the latest SVN versions. This is going to be fun!!!

chris-mac
8 Sep 2009, 5:28 AM
Thanks a lot for your help!

I modified my code/names as per your suggestions. It can be found here (http://extjs.wima.co.uk/example/18b).

Indeed a lot of fun with stacked windows :D

I am using Ext JS 3.0.0 Public Release.

Best regards,
Chris

chris-mac
9 Sep 2009, 1:41 AM
Shall I maybe create a new thread in Ext 3.0 Bugs forum for this?

Animal
9 Sep 2009, 2:28 AM
A drop event is delivered to every DragDrop object who's Region contains the mouse position.

So in that left hand situation in the image, both drop zone 1 and and drop zone 2 will be notified.

I have already posted a workaround to this.

chris-mac
9 Sep 2009, 2:32 AM
But shouldn't ddGroup limit scope of notifyDrop event only to the components within the group?

Could you please let me know where I can find your workaround?

Animal
9 Sep 2009, 4:23 AM
Yes, only drop zones which are members of the same group(s) as the drag source should be notified. If your lower drop zone is not a member of the same group, then there's something funny going on.

Last discussed here with links to the previous occurrence: http://www.extjs.com/forum/showthread.php?t=59583

chris-mac
9 Sep 2009, 4:46 AM
So shall I report this as a bug in Ext 3.0 Bugs forum?

9 Sep 2009, 4:49 AM
I would say yes. I have exhausted whatever time i can for this.

chris-mac
9 Sep 2009, 5:10 AM
Reported as a bug: http://www.extjs.com/forum/showthread.php?t=79931