Extjs面板扩展
我有一个 extjs 面板。我需要为此面板引入拖动和调整大小属性。
这是创建面板的代码:
var childPanel = new Ext.Panel({
draggable: true,
layout: 'fit',
................
});
我已经使用以下代码实现了拖动和调整属性大小:
Ext.override(Ext.Panel, {
// private
initEvents: function () {
if (this.draggable) {
this.initDraggable();
}
this.resizer = new Ext.Resizable(this.el, {
animate: true,
duration: '.6',
easing: 'backIn',
handles: 'all',
pinned: false,
transparent: true
});
this.resizer.on("resize", this.onResizer, this);
},
onResizer: function (oResizable, iWidth, iHeight, e) {
this.setHeight(iHeight);
this.setWidth(iWidth);
}
});
如您所见,我正在覆盖该属性。因此,我创建的所有面板都具有这些属性。我不想这样。
我知道 Ext.extend 是要使用的方法,但每次我都会遇到一些错误。我需要的是带有上述代码的扩展面板。
有人可以帮助我实现这一目标吗?
I have an extjs panel. I need to induce a drag and resizing property for this panel.
This is the code for creating the panel:
var childPanel = new Ext.Panel({
draggable: true,
layout: 'fit',
................
});
I have achieved drag and resizing properties using the code:
Ext.override(Ext.Panel, {
// private
initEvents: function () {
if (this.draggable) {
this.initDraggable();
}
this.resizer = new Ext.Resizable(this.el, {
animate: true,
duration: '.6',
easing: 'backIn',
handles: 'all',
pinned: false,
transparent: true
});
this.resizer.on("resize", this.onResizer, this);
},
onResizer: function (oResizable, iWidth, iHeight, e) {
this.setHeight(iHeight);
this.setWidth(iWidth);
}
});
As you can see I am overriding the property. Therefore all the panels that I create have these properties. I don't want it like that.
I know that Ext.extend is the method to use but each time I am getting some errors. What I need is an extended panel with the above code.
Can anybody help me to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
延伸累了吗?有哪些错误?
您应该记住从扩展方法中调用超类构造函数。
Have you tired extending? what were the errors?
Your should remmeber to call the superclass constructor from the extended methods.