ExtJs之addManagedListener

简介:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<! DOCTYPE html>
< html >
< head >
     < title >ExtJs</ title >
         < meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
         < link rel="stylesheet" type="text/css" href="ExtJs/packages/ext-theme-crisp/build/resources/ext-theme-crisp-all.css">
       < script type="text/javascript" src="ExtJs/ext-all.js"></ script >
       < script type="text/javascript" src="ExtJs/bootstrap.js"></ script >
       < script type="text/javascript" src="ExtJs/packages/ext-theme-crisp/build/ext-theme-crisp.js"></ script >
</ head >
< body >
< script type="text/javascript">
 
Ext.onReady(function(){
   function createFn(){
     alert('新建');
   }
   function openFn(){
     alert('打开');
   }
   function saveFn(){
     alert('保存');
   }
   Ext.create('Ext.toolbar.Toolbar',{
     renderTo: Ext.getBody(),
     bodyPadding: 5,
     width: 500,
     items: [
       {text: '新建', id: 'createBtn', iconCls: 'newIcon'},
       {text: '打开', id: 'openBtn', iconCls: 'openIcon'},
       {text: '保存', id: 'saveBtn', iconCls: 'saveIcon'},
       {text: '销毁新建按钮', handler: function(){
         Ext.getCmp('createBtn').destroy();
       }}
     ]
   });
   var createBtn = Ext.getCmp('createBtn');
   createBtn.on('click', createFn);
   createBtn.addManagedListener(Ext.getCmp('openBtn'), 'click', openFn);
   createBtn.addManagedListener(Ext.getCmp('saveBtn'), 'click', saveFn);
});
</ script >
< body >
</ body >
</ html >

  

目录
相关文章
|
移动开发 开发框架 JavaScript
EasyUI与EXTjs有什么区别
EasyUI与EXTjs有什么区别
EasyUI与EXTjs有什么区别
|
前端开发 JavaScript .NET
|
JSON JavaScript 数据格式
|
前端开发 JavaScript Web App开发
|
缓存 JavaScript 存储

相关实验场景

更多