PDA

View Full Version : How to pass parameter to function in MVC architecture



sponge_bob
28 Nov 2013, 9:27 PM
init: function() {

this.control({
'#speedCheck': {
change :this.disableFlied("aaa")
}
});

},
disableFlied: function(cmpName){

var a = Ext.getCmp(cmpName);
a.setDisabled(!a.isDisabled());

}

I want to pass parameter "aaa" to disableFlied function, but the code above didn't work. How to pass "aaa" to disableFlied function?

xjscrafter
29 Nov 2013, 5:19 AM
Try this (wrap the handler in a function):


init: function() {
this.control({
'#speedCheck': {
change: function () {
this.disableFlied("aaa");
}
}
});


},
disableFlied: function(cmpName){
var a = Ext.getCmp(cmpName);
a.setDisabled(!a.isDisabled());
}


If the handler is not wrapped in a function, it should just be the function name, no params.

If this post answers your question, please mark it as such. Thanks!