[转]extjs组件添加事件监听的三种方式

原文地址:http://blog.csdn.net/y6300023290/article/details/18989635

1.在定义组件配置的时候设置

[javascript] view plain copy 在CODE上查看代码片派生到我的代码片
  1. xtype : 'textarea',    
  2. name : 'dataSetField',    
  3. labelSeparator:'',    
  4. fieldLabel:'',    
  5. hideLabel: true,    
  6. allowBlank: true,    
  7. height: mainPanelHeight*0.8,    
  8. anchor:'99%',    
  9. listeners:{'blur':function(){    
  10.    alert(1);    
  11. }}    


2.对组件变量通过on设置

[javascript] view plain copy 在CODE上查看代码片派生到我的代码片
  1. gridPanel.on('rowdblclick',function(gridPanel,_rowIndex,e){    
  2.   alert(2);    
  3. }    


3.通过组件变量方法addListener()设置

[javascript] view plain copy 在CODE上查看代码片派生到我的代码片
    1. gridPanel.addListener('rowclick',function(){    
    2.  alert(3)}    
    3. );    
原文地址:https://www.cnblogs.com/dirgo/p/5474489.html