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

来源:互联网 发布:php常用类 编辑:程序博客网 时间:2024/05/21 10:07

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

xtype : 'textarea',  name : 'dataSetField',  labelSeparator:'',  fieldLabel:'',  hideLabel: true,  allowBlank: true,  height: mainPanelHeight*0.8,  anchor:'99%',  listeners:{'blur':function(){     alert(1);  }}  

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

gridPanel.on('rowdblclick',function(gridPanel,_rowIndex,e){    alert(2);  }  

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

gridPanel.addListener('rowclick',function(){   alert(3)}  );  


1 0
原创粉丝点击