Calling a call handler function with parameter

I am using sencha touch. Can I call a parameterized handler function on a sheet action element? If so, how to do it. Please help me .. I want to do this,

var z = function test(){alert('Hellow')}; 

In the handler function:

 handler:function(z){ alert(z); } 

he does not work. Just showing up .. "Index.html (Object: Object)" Thanks in advance

+4
source share
1 answer

Yes, you can do this, but it depends on the parameters provided by the calling handler device. In the case of a button, this will be a 'click' event. But you can always look at all the arguments passed when reading the arguments array, for example

 handler:function(){ console.log(arguments); } 

and if you know that there is, for example, one argument that you know, you can define it (let's take a button)

 handler:function(btn){ btn.disable(); } 

You also need to know that alert does not have the ability to print JavaScript objects! Use console.log for this.

+2
source

All Articles