[open-ils-commits] r15685 - trunk/Open-ILS/web/js/dojo/openils/widget (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Mar 3 15:25:49 EST 2010
Author: erickson
Date: 2010-03-03 15:25:44 -0500 (Wed, 03 Mar 2010)
New Revision: 15685
Modified:
trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
Log:
additional code-level comments
Modified: trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js 2010-03-03 20:25:44 UTC (rev 15684)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js 2010-03-03 20:25:44 UTC (rev 15685)
@@ -386,14 +386,20 @@
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
+
+ // 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,
- 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 @@
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];
}
More information about the open-ils-commits
mailing list