honor non-IDL fields in the fieldOrder
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 11 May 2009 19:18:44 +0000 (19:18 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 11 May 2009 19:18:44 +0000 (19:18 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13129 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 6b20006..93ff321 100644 (file)
@@ -40,16 +40,19 @@ if(!dojo._hasResource['openils.widget.AutoWidget']) {
 
             if(this.fieldOrder) {
 
-                for(var idx in this.fieldOrder) {
-                    var name = this.fieldOrder[idx];
-                    for(var idx2 in this.fmIDL.fields) {
-                        if(this.fmIDL.fields[idx2].name == name) {
-                            this.sortedFieldList.push(this.fmIDL.fields[idx2]);
-                            break;
+                var self = this;
+                dojo.forEach(this.fieldOrder,
+                    function(name) {
+                        var field = self.fmIDL.fields.filter(function(item) { return (item.name == name) } )[0];
+                        if(field) {
+                            self.sortedFieldList.push(field)
+                        } else {
+                            // non-IDL field
+                            self.sortedFieldList.push({name : name});
                         }
                     }
-                }
-                
+                );
+
                 // if the user-defined order does not list all fields, 
                 // shove the extras on the end.
                 var anonFields = [];