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

来源:互联网 发布:gson遍历json key 编辑:程序博客网 时间:2024/06/01 22:57

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

[javascript] view plain copy
xtype : ‘textarea’,
name : ‘dataSetField’,
labelSeparator:”,
fieldLabel:”,
hideLabel: true,
allowBlank: true,
height: mainPanelHeight*0.8,
anchor:’99%’,
listeners:{‘blur’:function(){
alert(1);
}}

2.对组件变量通过on设置
[javascript] view plain copy
gridPanel.on(‘rowdblclick’,function(gridPanel,_rowIndex,e){
alert(2);
}

3.通过组件变量方法addListener()设置
[javascript] view plain copy
gridPanel.addListener(‘rowclick’,function(){
alert(3)}
);
转自:http://blog.csdn.net/y6300023290/article/details/18989635

0 0
原创粉丝点击