PDA

View Full Version : Dragging Panels - Offset between drag container and actual object



alamandrax
25 Nov 2007, 3:07 AM
This is a continuation of my previous post about Dragging elements into Grid cells: http://extjs.com/forum/showthread.php?t=19056

I use a simple Panel configured to be a DragSource


...
var myNewPanel = new Ext.Panel({
height: '300',
width: '100',
name: 'myPanel',
id: 'myPanel',
frame: true,
layout: 'absolute',
shadow: false,
floating: true,
title: 'hello'
});
...
var myDDPanel = Ext.get('myPanel');
myDDPanel.dd = new Ext.dd.DragSource(myDDPanel, {
ddGroup: 'myDragPanels',
isTarget: true,
centerFrame: false
});
myNewPanel.setPosition(100, 100);
...


The result when I drag the panel looks like the attachment. There is an offset between the drag container and the dragged element equal to the co-ordinate ticks that I put into the setPosition method... Is there another method in the DragSource class that I need to call?

Removing the setPosition method call does not show the panel element in my UI though. Is there another way of making the panel show up after adding it to the GridPanel?