[open-ils-commits] r18025 - trunk/Open-ILS/web/js/dojo/openils/widget (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Sep 27 11:23:12 EDT 2010


Author: miker
Date: 2010-09-27 11:23:10 -0400 (Mon, 27 Sep 2010)
New Revision: 18025

Modified:
   trunk/Open-ILS/web/js/dojo/openils/widget/FacetSidebar.js
Log:
Provide for limiting the number of classOrder elements to a specific number. Skips those without facet values.

Modified: trunk/Open-ILS/web/js/dojo/openils/widget/FacetSidebar.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/FacetSidebar.js	2010-09-27 12:45:58 UTC (rev 18024)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/FacetSidebar.js	2010-09-27 15:23:10 UTC (rev 18025)
@@ -66,6 +66,7 @@
             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 @@
                     );
                 }
 
+                var displayedItems = 0;
                 var me = this;
                 dojo.forEach(
                     classes,
@@ -126,7 +128,12 @@
                                 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 @@
                             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;
                                 }
                             );



More information about the open-ils-commits mailing list