次のようなExtJsクラスがあります。
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...
});
str
ここで、実行する必要のあるメソッド名を含む文字列=>を取得します。strの文字列で指定されたRuleExecutorのメソッドを呼び出す必要があります
メソッドは正しく呼び出されますが、引数は渡されません。
このような:
//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);
}