1886d5d3eadf17bf15566b51b4e7ecffba0e87ee
kent
  Mon Aug 27 15:52:08 2018 -0700
Making it so that facets only show most popular 20 unless you expand them.  Also when you expand they are sorted alphabetically rather than by popularity.

diff --git src/hg/lib/tablesTables.c src/hg/lib/tablesTables.c
index bc5b789..42e3b93 100644
--- src/hg/lib/tablesTables.c
+++ src/hg/lib/tablesTables.c
@@ -485,30 +485,34 @@
 		htmlPrintf("<a href='../cgi-bin/cdwWebBrowse?%s=%s|url|&cdwCommand=browseFiles"
 			"&browseFiles_facet_op=%s|url|"
 			"&browseFiles_facet_fieldName=%s|url|"
 			"&browseFiles_facet_fieldVal=%s|url|"
 			"&cdwBrowseFiles_page=1' "
 			"style='display:inline; position:relative; background-color:%s|none|; margin-left:5px;'"
 			">%s</a><br>\n",
 		    cartSessionVarName(), cartSessionId(cart),
 		    op, field->fieldName, "",
 		    color,
 		    "<Clear"
 		    );
 		}
 
 	    int valuesShown = 0;
+	    if (field->showAllValues)  // Sort alphabetically if they want all values 
+	        {
+		slSort(&field->valList, facetValCmp);
+		}
 	    for (val = field->valList; val; val=val->next)
 		{
 		boolean specificallySelected = (val->selected && !field->allSelected);
 		if ((val->selectCount > 0 && (field->showAllValues || valuesShown < FacetFieldLimit))
 		    || specificallySelected)
 		    {
 		    ++valuesShown;
 		    char *color = "#FFFFCC";
 		    if (val->selected)
 			color = "#CCFFFF";
 		    char *op = "add";
 		    if (specificallySelected)
 			op = "remove";
 		    printf("<DIV style='position:relative; left:%dpx; width: %dpx; background-color:#FFFFCC;'>\n",
 			valIndent, (facetMargin-valIndent));