events - Extjs 4.2 Parameter in listeners function -


i've got problem controller

ext.define('app.controller.mycontroller', {     init: function() {         this.control({             '#myinputfield': {                 change: this.textfieldchange(parameter)             }         })     },     textfieldchange: function(parameter) {       //do     } }); 

its problem when give parameter here

change: this.textfieldchange(parameter) 

then fire after site load , don't know why.

without parameter waiting change event should can any1 me please ?

it because:

change: this.textfieldchange here giving reference function property

change: this.textfieldchange(parameter) here giving result of function property (which if don't use return, undefined).

you can use eopts variable in function definition, custom parameter sending, see in example:

ext.define('app.controller.mycontroller', {     init: function() {         this.control({             '#myinputfield': {                 change: {                     fn : this.textfieldchange,                     params : {                         param1: 'something'                     }                 }             }         })     },     textfieldchange: function(textfield, newvalue, oldvalue, eopts) {         var params = eopts.params;         console.log(params.param1);       //do     } });


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -