ExtJS中listener方法和handler方法的区别
Posted 嘴里坚持着逞强,眼里的泪在投降
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ExtJS中listener方法和handler方法的区别相关的知识,希望对你有一定的参考价值。
listener方法和handler方法的区别在文档中的说明的太玄乎了,看不懂
listeners监听能够对一个click Event事件添加任意多个的事件响应处理函数
而handler处理只能够通过处理函数一次处理点击响应
Ext.create(‘Ext.Button‘, { text : ‘Dynamic Handler Button‘, renderTo: Ext.getBody(), handler : function() { // this button will spit out a different number every time you click it. // so firstly we must check if that number is already set: if (this.clickCount) { // looks like the property is already set, so lets just add 1 to that number and alert the user this.clickCount++; alert(‘You have clicked the button "‘ + this.clickCount + ‘" times.\n\nTry clicking it again..‘); } else { // if the clickCount property is not set, we will set it and alert the user this.clickCount = 1; alert(‘You just clicked the button for the first time!\n\nTry pressing it again..‘); } } });
new Ext.panel.Panel({ width: 400, height: 200, dockedItems: [{ xtype: ‘toolbar‘ }], listeners: { click: { element: ‘el‘, //bind to the underlying el property on the panel fn: function(){ console.log(‘click el‘); } }, dblclick: { element: ‘body‘, //bind to the underlying body property on the panel fn: function(){ console.log(‘dblclick body‘); } } } });
-------------------------------------------------------------------------------------------------------------------------------------------
以上是关于ExtJS中listener方法和handler方法的区别的主要内容,如果未能解决你的问题,请参考以下文章
ExtJS 下拉框监听事件日期选择器监听事件实现动态给items添加删除数据
ORA-12516:TNS:listener could not find available handler with matching protocol stack