1 year ago
#181624
vejce4
extjs keyMap addBinding method bug?
Hi I have 2 variants of code both do not work. My problem is I want to pass an argument into handler of addBinding method. console.log(x) returns as it should be but when it is passed into handler problem is that that the argument for that function is same for all of the bindings and I want to have it different base on tagValue (tagValue = argument I want in the function). What is wrong? Posting a 2 variants of code (good to mention that for example key is linked without any problem only handler have problems):
for (j = 0, len = ref1.length; j < len; j++) {
tag = ref1[j];
if (tag.key !== void 0) {
tagValue = name + "/" + tag.label;
tagKey = tag.key;
tagg = tag.label;
x = "this.onTagHotkey('" + ("" + tagValue) + "');";
console.log(x);
map.addBinding({
key: "" + tagKey,
scope: this,
handler: function() {
return eval(x); #problem here
}
});
console.log(map);
}
or
for (j = 0, len = ref1.length; j < len; j++) {
tag = ref1[j];
if (tag.key !== void 0) {
tagValue = name + "/" + tag.label;
tagKey = tag.key;
tagg = tag.label;
map.addBinding({
key: "" + tagKey,
scope: this,
handler: function() {
return this.onTagHotkey(tagValue); #problem here
}
});
console.log(map);
}
javascript
extjs
sencha-touch
keymapping
keymaps
0 Answers
Your Answer