PDA

View Full Version : panel drag and drop is not working in extjs 4.1



newsAnand
19 Dec 2011, 2:35 AM
This code is working in Extjs 4.0.2a but when converted to 4.1 (http://www.sencha.com/blog/ext-js-4-1-developer-preview/) it no longer works and gives an error like:
Uncaught TypeError: Cannot call method 'query' of undefined

My Code is:

Ext.onReady(function() {

var panel = new Ext.Panel({
renderTo : divtag,
draggable: {
insertProxy: false,
onDrag: function(e) {
var el = this.proxy.getEl();
this.x = el.getLeft(true);
this.y = el.getTop(true);
},
endDrag: function(e) {
this.panel.setPosition(this.x, this.y);
}
},
title: 'Panel',
width: 200,
height:100,
x: 20,
y: 20
});
});

mitchellsimoens
19 Dec 2011, 9:41 AM
getLeft(true) is only returning zero. If you are wanting to use XY coords, then you can use getXY() but what are you trying to accomplish?

Animal
22 Dec 2011, 11:20 AM
You are overriding implemented functions in Ext.panel.DD

You should only need draggable: true

Having said that, there's a slight bug with synching the panel position with the position of the dragged proxy upon mouseup if the Panel is it's default hideMode, 'display'.

I submitted a fix, but unfortunately, it's too late to get into beta 1. It will be fixed in 4.1.0 final.

A workaround is to configure the Panel hideMode: 'offsets'

shilpay
28 Dec 2012, 10:04 PM
Hi, The drag and drop code working in 4.0.7.
After I updated to 4.1 Drop is not working.
Let me know Is there any fix for Drag and Drop in ExtJs4.1

Thanks.