ExtJs 继承 和 插件 示例
2024-10-14 09:49:00
Ext.ns('Ext.ux'); function btn(){
alert(this.id);
};
var panel_plugs = {//定义插件
init : function(panel){
panel.width = 600;
panel.height = 300;
panel.title = '测试';
panel.tools = [{id:"maximize ",handler:btn},{id:"minimize ",handler:btn},{id:"close ",handler:btn}];
}
};
方法一:
Ext.MyPanel = function(){
//Ext.MyPanel.superclass.initComponent.call(this);
Ext.MyPanel.superclass.constructor.call(this,{
id : 'div_ext',
title : 'ceshi',
width : 600,
height : 300,
renderTo : 'div1',
tbar : [{text:"1"},{text:"2"},{text:"3"}]
})
};
Ext.extend(Ext.MyPanel,Ext.Panel,{
plugins : panel_plugs
});
方法二:
1 Ext.MyPanel = Ext.extend(Ext.Panel,{
id : 'div_ext',
title : 'ceshi',
width : 600,
height : 300,
renderTo : 'div1',
tbar : [{text:"1"},{text:"2"},{text:"3"}], plugins : panel_plugs
// constructor : function(){
// Ext.MyPanel.superclass.constructor.call(this);
// },
// initComponent : function(){
// Ext.MyPanel.superclass.initComponent.call(this);
// }
});
运行代码:
Ext.reg('mypanel',Ext.MyPanel); Ext.onReady(function(){
new Ext.MyPanel();
})
结果图:
最新文章
- Android Conflict with nineoldandroids等报错
- 高性能javascript(记录二)
- A multi-faceted language for the Java platform
- PHP爬虫(2)DOM处理
- BZOJ 2005: [Noi2010]能量采集
- PHP站内搜索、多关键字、加亮显示
- 理解assign,copy,retain变strong
- Android平台二维码之生成,扫描 &; 识别
- [MetaHook] R_RicochetSprite
- 【Valid Palindrome】cpp
- .Net学习难点讨论系列17 - 线程本地变量的使用
- 读书笔记之_Win10 与Jmeter5.1.1界面兼容:
- excel身份证验证(附带防止粘贴导致校验失效的函数)
- DWM1000 测距原理简单分析 之 SS-TWR
- springMVC(五): 通过 HandlerMapping 获取 HandlerExecutionChain
- No setter found for property 'cronExpression' in class 'org.springframework.scheduling.quartz.CronTriggerBean'
- 2018.10.18 NOIP训练 [SCOI2018]Pipi 酱的日常(线段树)
- ASP.NET MVC 5使用Filter过滤Action参数防止sql注入,让你代码安全简洁
- 有趣的 Mysql 存储引擎
- 获取项目路径js