0

I have a problem how to keep value of portsElement[i].Id during selection change in ComboBox. I've tried to make global variable, but during selection change in ComboBox it's showing me undefined.

My first try was to make variable, but that variable kept only the last value in all ComboBox-es.

for (var i = 0; i < portsElement.length; i++) {

     window['portId' + i] = portsElement[i].Id;  //this is the variable I would like to keep for each loop                                                                                                                          
     var cBox = new App.Components.ComboBox({                                                                                                                         
          listeners: {
             select: function (combo, record, index) {
                UpdateElementRefDetails({ Id: window['portId' + i] }, function () {
                    me.el.unmask();
                });
            }
        }
    });                                                            
}
FrenkyB
  • 6,625
  • 14
  • 67
  • 114
  • 2
    You can use `let i` in pretty much anything outside of IE. You can use Babel to transpile your code and then you'd be able to use `let` in every browser. – VLAZ Jun 18 '20 at 05:33
  • Works like a charm. Please post as answer if it is possible. – FrenkyB Jun 18 '20 at 06:55
  • 1
    No need for another answer. The [(in)famous issue](https://stackoverflow.com/q/1451009) already has many good canonical answers - I've linked to the duplicate. You'll find it at the top of the question. – VLAZ Jun 18 '20 at 06:58

0 Answers0