View Full Version : Set the position of a Draggable div?

17 Jun 2010, 5:36 AM
I have a page with some drag&drop items on it. I'd like to be able to programatically set the position of the DD elements. I cannot seem to see anything in the API to do this in the DD object and I have tried moving the item by using setLeft on the element but that then screws up the contraints.

Any advice would be appriciated, thanks.

17 Jun 2010, 5:37 AM
Nothing here http://www.sencha.com/deploy/dev/docs/?class=Ext.Element ?

17 Jun 2010, 5:48 AM
I cannot see anything there for moving DD elements without affecting the DD state ??? As I said I tried moving the element directly but then DD contraints then got messed up.

17 Jun 2010, 5:50 AM
No such thing as a DD element. There are elements and there is a DD class which allows you to drag them around (To no good use really)

17 Jun 2010, 6:02 AM
What I mean is that I have a div, to which I have tied a DD object to, like this:
ddobj = new Ext.dd.DD('markerDivId');
then set the constraints like this:
Now I have a marker I can move around inside an invisible box, all works well, I can move the marker fine and I can read off the position of the marker etc.
What I want to do now is set the position of the marker programatically. I have tried this:
Which moved the marker fine but resulted in the contraints moving with it as well thus messing things up. I have tried resetting the constraints and a load of other stuff over the course of about 4 hours but no luck.
What I want to do is to move the marker programatically as if I had just dragged it, leaving the constraints alone.

Hope that explains it a bit better

17 Jun 2010, 6:08 AM
I could dive down into the code and figure it out. It might take a couple of hours though which I don't have.