I've got problem with my controller
Ext.define('app.controller.myController', {
init: function() {
this.control({
'#myinputfield': {
change: this.textFieldChange(parameter)
}
})
},
textFieldChange: function(parameter) {
//do something
}
});
its look like this the problem is when i give parameter here
change: this.textFieldChange(parameter)
then its fire up after site load and I don't know why.
without parameter its waiting for change event like it should can any1 help me please ?
It is because:
change: this.textFieldChange
here you are giving the reference for this function to this property
change: this.textFieldChange(parameter)
here you are giving the result of the function to this property (which if we don't use return, then it will be undefined
).
You can use the eOpts
variable in the function definition, for 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 something } });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With