Loop separately for addSingleScaffold and makeSingleFacet
authorMike Taylor <mike@indexdata.com>
Fri, 4 Apr 2014 15:25:36 +0000 (16:25 +0100)
committerMike Taylor <mike@indexdata.com>
Fri, 4 Apr 2014 15:25:36 +0000 (16:25 +0100)
src/mkws-widget-termlists.js

index cfb603a..135f322 100644 (file)
@@ -31,6 +31,15 @@ mkws.registerWidgetType('Termlists', function() {
                alert("bad facet configuration: '" + name + "'");
            } else {
                addSingleScaffold(acc, ref[0]);
+           }
+       }
+
+       for (var i = 0; i < facets.length; i++) {
+           var name = facets[i]
+           var ref = facetConfig[name];
+           if (!ref) {
+               alert("bad facet configuration: '" + name + "'");
+           } else {
                output[name] = makeSingleFacet(ref[0], data[name], ref[1], ref[2] ? name : null);
            }
        }