From: erickson Date: Mon, 11 May 2009 19:18:44 +0000 (+0000) Subject: honor non-IDL fields in the fieldOrder X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8cc734f278b42a0390501b3f8e99ed88d4ec92b1;p=Evergreen.git honor non-IDL fields in the fieldOrder git-svn-id: svn://svn.open-ils.org/ILS/trunk@13129 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoWidget.js b/Open-ILS/web/js/dojo/openils/widget/AutoWidget.js index 6b200069ba..93ff321f6a 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoWidget.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoWidget.js @@ -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 = [];