javascript - Passing a local variable into an event handler -


h.d.d.w = ext.extend(w.g.a, {     initcomponent: function () {       examplefunctiona('monday');        //other fields omitted     }     examplefunctiona: function (dayofweek) {         this['weekdayhoursstore' +dayofweek] = new ext.data.store({             proxy: a.b.c.getproxy('d/e.asmx/f'),             reader: g.h.i.j(             [               //array of config objects removed             ]),             sortinfo: //omitted         });          this['weekdayhoursstore' +dayofweek].load(         {             params:           {               //parameters removed           }         });         this['weekdayhoursstore' +dayofweek].on("load", this._renderhours, this);         //irrelevant code removed     },      _renderhours: function (dayofweek) {         var dayindex;         for(var = 0; i<7; i++){             if(this.weekdays[i] === dayofweek){                 dayindex = i;                 break;             }         }         var record = this.weekdayhoursstore.getat(dayindex);         this['usedefaultvalue' +dayindex] = record.get("usedefault");     }     //further class members omitted } 

how can pass dayofweek _renderhours?

you can create anonymous function , call this._renderhours it:

this['weekdayhoursstore' +dayofweek].on("load", function() {     this._renderhours(dayofweek); }, this); 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -