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 i = 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
}
如何将dayOfWeek传递给_renderHours?
答案 0 :(得分:4)
您可以创建一个匿名函数并从中调用this._renderHours
:
this['WeekdayHoursStore' +dayOfWeek].on("load", function() {
this._renderHours(dayOfWeek);
}, this);