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

时间:2023-03-09 03:55:59
[转]extjs组件添加事件监听的三种方式

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

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

  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设置

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

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

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