additional code-level comments
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 3 Mar 2010 20:25:44 +0000 (20:25 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 3 Mar 2010 20:25:44 +0000 (20:25 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15685 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js

index 1586280..49ccf7c 100644 (file)
@@ -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];
                 }