From: Jakub Skoczen Date: Thu, 3 Mar 2011 01:24:22 +0000 (+0100) Subject: Draw selected facets when no results X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=d029cee1b34b02722d9e6d9534b002fa07a8c8ef;p=mkdruding2.git Draw selected facets when no results --- diff --git a/mkdruding2.js b/mkdruding2.js index b29f49d..65e08d9 100644 --- a/mkdruding2.js +++ b/mkdruding2.js @@ -56,7 +56,7 @@ Drupal.theme.mkdruFacetContainer = function (facetsData, facetsCfg) { return html; }; -Drupal.theme.mkdruFacet = function (terms, facet, max) { +Drupal.theme.mkdruFacet = function (terms, facet, max, selections) { var html = ""; for (var i = 0; i < terms.length && i < max; i++ ) { var term = terms[i]; @@ -66,7 +66,15 @@ Drupal.theme.mkdruFacet = function (terms, facet, max) { if (term.selected) html += ""; html += ' (' + terms[i].freq + ')
'; - + } + var sel = selections[facet]; + if (terms.length == 0 && sel && sel.length) { + for (var i=0; i'+sel[i]+' (0)
'; + } + } } return html; };