Extjs在panel的标题栏上加按钮的方法

Ext.define('MyPanel',{
extend:'Ext.panel.Panel',
xtype:'mypanel',
title:'title',
height:200,
initComponent:function(){
var me=this;
me.okBtn = new Ext.button.Button({
//按钮位置可通过此样式进行修改,如果按钮靠右显示可修改为把left改成right
//采用此解决方案可以避免标题栏被撑高。
style:'position: absolute;top: 5px;left: 60px;',
text: 'ok',scope: me,
handler:function(){
alert('ok click');
}
});
this.callParent();
},
onRender:function(){
this.callParent(arguments);
this.okBtn.render(Ext.get(this.getHeader().id));
},
onDestroy: function() {
this.okBtn.destroy();
this.callParent();
}
});
posted @ 2017-08-22 16:32  拉风的帅猫  阅读(830)  评论(0编辑  收藏  举报