I have an ExtJs class that looks like this:
Ext.define("RuleExecutor", {
singleton: true,
displayMessage: function(msg) {
Ext.Msg.alert('Popup Message', msg[0]);
},
disableById: function(field) {
Ext.getCmp(field).setDisabled(true);
},
//more functions are here...
});
Now I get a string => str which contains the method name I need to run. I need to call the method in RuleExecutor specified by the string in str
The method is called correctly, but the arguments are not passed.
Like this:
//arguments is an array
function RunRule(str, arguments) {
//I tried this....
var fn = RuleExecutor[str];
fn(arguments)
//This doesn't work either..
RuleExecutor[str].apply(this, arguments);
}
RunRule()? I don't know if something else applies for ExtJs, but by convention, function names start with a lower case letter.The method is called correctly.... Sorry!