From: Mike Taylor Date: Fri, 4 Apr 2014 16:00:50 +0000 (+0100) Subject: Scaffolding is now generated immediately, not when data arrives. X-Git-Tag: 1.0.0~1018 X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=commitdiff_plain;h=9ea6b8571266796b8410c320a39be15d8ee830cc Scaffolding is now generated immediately, not when data arrives. --- diff --git a/src/mkws-widget-termlists.js b/src/mkws-widget-termlists.js index 69d97a5..db36c66 100644 --- a/src/mkws-widget-termlists.js +++ b/src/mkws-widget-termlists.js @@ -1,5 +1,6 @@ mkws.registerWidgetType('Termlists', function() { var that = this; + var facets = that.config.facets; var M = mkws.M; var facetConfig = { @@ -8,28 +9,25 @@ mkws.registerWidgetType('Termlists', function() { author: [ "Authors", 10, true ] } - this.team.queue("termlists").subscribe(function(data) { - // no facets: this should never happen - var facets = that.config.facets; + var acc = []; + acc.push('
' + M('Termlists') + '
'); + for (var i = 0; i < facets.length; i++) { + var name = facets[i] + var ref = facetConfig[name]; + if (!ref) { + alert("bad facet configuration: '" + name + "'"); + } else { + acc.push('
'); + acc.push('
'); + } + } + $(that.node).html(acc.join('')); + + this.team.queue("termlists").subscribe(function(data) { // display if we first got results $(that.node).show(); - var acc = []; - acc.push('
' + M('Termlists') + '
'); - for (var i = 0; i < facets.length; i++) { - var name = facets[i] - var ref = facetConfig[name]; - if (!ref) { - alert("bad facet configuration: '" + name + "'"); - } else { - acc.push('
'); - acc.push('
'); - } - } - $(that.node).html(acc.join('')); - - for (var i = 0; i < facets.length; i++) { var name = facets[i] var ref = facetConfig[name];