PDA

View Full Version : DD doubts



moraes
11 May 2007, 4:19 AM
Hi,
1. Maybe I'm doing something wrong, but I've noticed that if you drop something in the very border limit of a DropTarget or DropZone, the drop event considers the outside of the element as the target (althought it may not be set a DropTarget / DropZone) and proceeds normally. This sometimes has a bad effect, with things being dropped in a place where they are not allowed. I had to add checkings to onNodeDrop / notifyDrop to avoid this. Anyone else noticed this or have an idea about what is causing this?

2. How to set a whole div, including its child nodes, dragable as an unique element?

thanks!

moraes
11 May 2007, 9:12 AM
I posted an example here:

http://www.tipos.com.br/dev/extjs/dd_1.php

Clarifying:

1. Although the page body is not a drop target, if you drop an element on the edge of any drop targets, the dragable element is dropped in the body. Is it an ex

jay@moduscreate.com
11 May 2007, 9:33 AM
Thanks for posting the link. I'm trying to understand EXT's D&D module, this should help a bit.

moraes
11 May 2007, 9:44 AM
I hope it helps! I'm trying to understand it too! :)

moraes
11 May 2007, 9:49 AM
Hmmm. I'm affraid I'm flooding a thread created by myself, but I have one more doubt.

3. Which trick do you use to keep a drop area not empty, so it will be always available? If a div is empty, it will disappear on FF, and then you lose your drop area...

A fixed height is a bad idea (put all the dargables in the same box in the example above, and one of them will be not available because it is out of the height).

Setting a min-height could solve the issue on FF, but I guess it would not work on IE...

So, how to ensure that the div will be 'expanded' and 'available' even if it is empty?

jsakalos
11 May 2007, 9:56 AM
Cannot you use handles, e.g. a parent container?

moraes
11 May 2007, 9:59 AM
Cannot you use handles, e.g. a parent container?
Ah, that's what I'm doing, a handle in the top of a parent container. I was just checking if it was the right thing to do or there was a trick to make the whole thing dragable. It seems that a handle is the right solution, then. Thanks.

jsakalos
11 May 2007, 10:00 AM
I cannot tell if it right but I can tell it works like charm for me;)

moraes
11 May 2007, 11:19 AM
Some more DD doubts...

4. How to change the text that appears in the 'ghost' layer when you are dragging an element.

5. How to create a smooth temporary div to show the place where the element will be dropped. I've created it here but as you see it is very rudimentar...

http://www.tipos.com.br/dev/extjs/dd_2.php

Any shinning Ext.dd example?

jsakalos
11 May 2007, 11:23 AM
Re 3: I do not have time to modify the following to be more understandable, but I guess it can help.


// setup DragSource
if(this.persData) {
if(!this.persDDS) {
var persDiv = Ext.get(this.persNode.dom.firstChild);
this.persDDS = new Ext.dd.DragSource(persDiv, {
ddGroup: 'person'
, dragData: this
});
this.persDDS.addToGroup('trash');
this.persDDS.onStartDrag = function() {
// modify the drag ghost to contain not only icon but also full name
var node = Ext.get(this.proxy.ghost.select("[@class*='ob-node-pers-false']"));
if(!node.elements.length) {
var node = Ext.get(this.proxy.ghost.select("[@class*='ob-node-pers-true']"));
}
if(node.elements.length) {
node.update(this.dragData.persData.persFullName);
node.set({style:'background-position:0 0'});
}
};
}
}

moraes
12 May 2007, 10:27 AM
Re 3: I do not have time to modify the following to be more understandable, but I guess it can help.
It helped a bit, yes, thank you. :)