From 335daa25a782337311e391fb9dddcde03541a0ae Mon Sep 17 00:00:00 2001 From: miker Date: Mon, 27 Sep 2010 15:23:10 +0000 Subject: [PATCH] Provide for limiting the number of classOrder elements to a specific number. Skips those without facet values. git-svn-id: svn://svn.open-ils.org/ILS/trunk@18025 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/dojo/openils/widget/FacetSidebar.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/widget/FacetSidebar.js b/Open-ILS/web/js/dojo/openils/widget/FacetSidebar.js index 9256ce4c7..25c2175d8 100644 --- a/Open-ILS/web/js/dojo/openils/widget/FacetSidebar.js +++ b/Open-ILS/web/js/dojo/openils/widget/FacetSidebar.js @@ -66,6 +66,7 @@ if(!dojo._hasResource["openils.widget.FacetSidebar"]) { facetCacheKey : '', searchBox : '', classOrder : null, // Array of cmc.name values, OR array of objects with name and facetOrder properties + displayItemLimit : 999, // Number of distinctly described entries (classes or facets), that have values, to display from classOrder searchSubmit : '', facetLimit : 10, maxValuesPerFacet : 100, @@ -116,6 +117,7 @@ if(!dojo._hasResource["openils.widget.FacetSidebar"]) { ); } + var displayedItems = 0; var me = this; dojo.forEach( classes, @@ -126,7 +128,12 @@ if(!dojo._hasResource["openils.widget.FacetSidebar"]) { var maybe_facet = dojo.filter( openils.widget.Searcher._cache.arr.cmf, function (y) { - if (y.field_class == x.name && y.name == fname && facetData[y.id]) return 1; + if (y.field_class == x.name && y.name == fname && facetData[y.id]) { + if (displayedItems < me.displayItemLimit) { + displayedItems++; + return 1; + } + } return 0; } )[0]; @@ -136,7 +143,12 @@ if(!dojo._hasResource["openils.widget.FacetSidebar"]) { possible_facets = dojo.filter( openils.widget.Searcher._cache.arr.cmf, function (y) { - if (y.field_class == x.name && facetData[y.id]) return 1; + if (y.field_class == x.name && facetData[y.id]) { + if (displayedItems < me.displayItemLimit) { + displayedItems++; + return 1; + } + } return 0; } ); -- 2.11.0