【发布时间】:2012-01-23 10:04:44
【问题描述】:
此代码在 Extjs 4.0.2a 中运行 但是当转换为4.1 时,它不再起作用并给出错误
Uncaught TypeError: Cannot call method 'query' of undefined
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
});
});
【问题讨论】:
-
我尝试了以下代码,该代码适用于 Component 但不适用于 Panel :( 并引发错误:Uncaught TypeError: Object [object Object] has no method 'ensureAttachedToBody'
Ext.onReady(function() { new Ext.Component({ constrain: true, title:'Test', floating: true, style: { backgroundColor: '#fff', border: '1px solid black' }, html: '<h1 style="cursor:move">The title</h1><p>The content</p>', draggable: { delegate:this.body } }).show(); });
标签: javascript extjs extjs4 javascript-framework