'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);
      }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source