From: erickson Date: Wed, 3 Mar 2010 20:25:44 +0000 (+0000) Subject: additional code-level comments X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0018ae43cb54bbb9514075a36e5c902216ea78f8;p=evergreen%2Fpines.git additional code-level comments git-svn-id: svn://svn.open-ils.org/ILS/trunk@15685 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js index 158628058c..49ccf7c235 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js @@ -386,14 +386,20 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) { var storeData = {data:fieldmapper[linkClass].toStoreData(list)}; if(self.labelFormat) { - // set the label for each value in the store based on the provide label format - var format = self.labelFormat[0]; + + // set the label for each value in the store based on the provided label format. + var format = self.labelFormat[0]; dojo.forEach(storeData.data.items, + function(item) { var values = []; - for(var i = 1; i< self.labelFormat.length; i++) + + // self.labelFormat[1..*] are names of fields. Pull the field + // values from each object to determine the values for string substitution + for(var i = 1; i< self.labelFormat.length; i++) values.push(item[self.labelFormat[i]]); + item._label = dojo.string.substitute(format, values); } ); @@ -401,6 +407,7 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) { self.widget.store = new dojo.data.ItemFileReadStore(storeData); self.cache[self.auth].list[linkClass] = self.widget.store; + } else { self.widget.store = self.cache[self.auth].list[linkClass]; }