Changeset View
Changeset View
Standalone View
Standalone View
core/admin_templates/js/dropdown_mapper.js
function DropDownMapper(map, request, input_mask) { | function DropDownMapper(map, request, input_mask) { | ||||
this.Map = map; | this.Map = map; | ||||
this.Request = request; | this.Request = request; | ||||
this.InputMask = input_mask; | this.InputMask = input_mask; | ||||
this.Objects = new Object(); | this.Objects = new Object(); | ||||
this.WatchFields = []; | this.WatchFields = []; | ||||
this.UpdateFields = {}; | this.UpdateFields = {}; | ||||
this.Init() | this.Init() | ||||
} | } | ||||
DropDownMapper.prototype.Init = function() | DropDownMapper.prototype.Init = function() | ||||
{ | { | ||||
var mapper = this; | |||||
alex: This worked in other projects because:
* there was only 1 instance of `DropDownMapper` class… | |||||
this.AssignDrills(this.Map); | this.AssignDrills(this.Map); | ||||
this.DrillDownRequests(this.Map,'root'); | this.DrillDownRequests(this.Map,'root'); | ||||
for (var i = 0; i < this.WatchFields.length; i++) { | for (var i = 0; i < this.WatchFields.length; i++) { | ||||
var elem = document.getElementById(this.InputMask.replace('#FIELD#', this.WatchFields[i])); | var elem = document.getElementById(this.InputMask.replace('#FIELD#', this.WatchFields[i])); | ||||
elem.fieldName = this.WatchFields[i]; | elem.fieldName = this.WatchFields[i]; | ||||
addEvent(elem, 'change', function(ev) { | addEvent(elem, 'change', function(ev) { | ||||
var el = !is.ie ? ev.currentTarget : window.event.srcElement; | var el = !is.ie ? ev.currentTarget : window.event.srcElement; | ||||
mapper.Changed(el.fieldName); | mapper.Changed(el.fieldName); | ||||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | |||||
this.DrillDownRequests(map[i].SubNodes,item); //if there is no object for current item, try its children | this.DrillDownRequests(map[i].SubNodes,item); //if there is no object for current item, try its children | ||||
} | } | ||||
} | } | ||||
} | } | ||||
DropDownMapper.prototype.QueryByField = function(field) | DropDownMapper.prototype.QueryByField = function(field) | ||||
{ | { | ||||
this.Objects[field].Query(); | this.Objects[field].Query(); | ||||
} | } | ||||
No newline at end of file |
This worked in other projects because:
In fact this is recommended workaround until this patch is merged.
I can't really tell if variable name was chosen to match local variables in class itself or people using the class are just lucky.