最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
ExtJs自定义组件事件绑定两个实例
时间:2022-06-25 18:28:54 编辑:袖梨 来源:一聚教程网
例1
优化了一下代码,结果如下。
调用:
| 代码如下 | 复制代码 |
组件定义
| 代码如下 | 复制代码 |
|
Ext.define('WX.student.AddStudent', { modal:true, }); |
|
例2
新件一个JS文件
| 代码如下 | 复制代码 |
|
// JavaScript Document 编号:{ID} ',' 姓名:{FirstName}-{LastName} ',' 电话:{Phone} ',' 城市:{City} ',' 邮箱:{Email} ']), initComponent:function(){ CRM.Panels.UserDetail.superclass.initComponent.call(this); if(typeof this.tpl === 'string'){ this.tpl = new Ext.XTemplate(this.tpl); } this.addEvents('UAlert');//注册新事件 this.addListener({//侦听函数 UAlert: { //注册的新事件 fn:this.onAlert,//调用onAlert方法 scope: this } }); }, ////////////// onAlert: function(){ alert('注册的新事件'); }, UAlert:function(){ this.fireEvent('UAlert'); }, ///////////////////// onRender: function(ct, position){ CRM.Panels.UserDetail.superclass.onRender.call(this, ct, position); if(this.data){ this.update(this.data); } }, update: function(data){ this.data = data; this.tpl.overwrite(this.body, this.data); // this.fireEvent('update',this.data); } }); //把新建的自定义组件注册为一种xtype
|
|
在页面上:
| 代码如下 | 复制代码 |
|
|
|
相关文章
- 詹妮弗·劳伦斯暗示并基本确认将在《饥饿游戏 收获之晨》中回归 07-15
- 无人深空矿物提取元素类物品合成制作方式配方 07-15
- 深海迷航独眼巨人号碎片分布位置在哪 07-15
- 逆战未来火山口枪械技能介绍 07-15
- 逐出第七关森林怎么过 07-15
- 《神探杰克鼠》支线1玩法介绍 07-15