最新下载
热门教程
- 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
|
|
在页面上:
| 代码如下 | 复制代码 |
|
|
|
相关文章
- 二重螺旋狩月人魔之楔怎么配-狩月人魔之楔搭配推荐 11-06
- 洛克王国世界s1限定精灵蛋怎么获得-s1赛季炫彩蛋获取方法 11-06
- 天国拯救2大嘴约翰尼支线任务攻略分享 11-06
- 天国拯救2成名时刻支线任务攻略分享 11-06
- 天国拯救2赦免者支线任务完成方法分享 11-06
- 东方异域见闻魔理沙普攻流无伤轮椅攻略 11-06