This code is working in Extjs 4.0.2a but when converted to 4.1 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
});
});