6c1f41fb7917a57861810431337b400d21714c25
galt
Thu Jan 30 18:17:24 2020 -0800
Initial check-in for a new top-bar showing the selected facets and their values for easily seeing what has been selected, and de-selecting is easy by clicking there if you want to. Also added an explicit button for clearing the Restrictions, i.e. cdwFile_filter cart var filter.
diff --git src/hg/lib/tablesTables.c src/hg/lib/tablesTables.c
index cebcf2c..d0cacd3 100644
--- src/hg/lib/tablesTables.c
+++ src/hg/lib/tablesTables.c
@@ -382,46 +382,148 @@
"$('[name=%s_page]').val('%d');\n"
"$('#submit').click();\n"
, varPrefix, totalPages);
}
}
}
}
void webFilteredFieldedTable(struct cart *cart, struct fieldedTable *table,
char *returnUrl, char *varPrefix,
int maxLenField, struct hash *tagOutputWrappers, void *wrapperContext,
boolean withFilters, char *itemPlural,
int pageSize, struct fieldedTableSegment *largerContext, struct hash *suggestHash,
struct facetField **ffArray, char *visibleFacetList,
- void (*addFunc)(int))
+ void (*addFunc)(int), char *initialWhere)
/* Show a fielded table that can be sorted by clicking on column labels and optionally
* that includes a row of filter controls above the labels .
* The maxLenField is maximum character length of field before truncation with ...
* Pass in 0 for no max */
{
if (strchr(returnUrl, '?') == NULL)
errAbort("Expecting returnUrl to include ? in showFieldedTable\nIt's %s", returnUrl);
if (withFilters || visibleFacetList)
showTableFilterInstructionsEtc(table, itemPlural, largerContext, addFunc, visibleFacetList);
+// show top bar with quick-deselects
+if (visibleFacetList)
+ {
+ // left column
+ printf("
\n");
+
+ struct slName *nameList = slNameListFromComma(visibleFacetList);
+ int f;
+ for (f = 0; f < table->fieldCount; ++f)
+ {
+ struct facetField *field = ffArray[f];
+ if (slNameInListUseCase(nameList, field->fieldName)) // i.e. is this field a visible facet?
+ {
+ if (!field->allSelected) // something selected TODO is this really the right expression?
+ {
+ htmlPrintf("\n");
+ htmlPrintf("
\n");
+ htmlPrintf("
%s
\n", field->fieldName);
+
+ // why did this newer way not seem to work? or at least to only affect the dds and not the dts?
+
+ // save old way: style='display: inline; float: left;'
+
+ struct facetVal *val;
+
+ int valuesShown = 0;
+ int valuesNotShown = 0; // can be used for a click to see-more when there are lots of values
+
+ // Sort values alphabetically
+ // Make a copy to not disturb the original order
+ struct facetVal *valListCopy = facetsClone(field->valList);
+ slSort(&valListCopy, facetValCmp);
+
+ for (val = valListCopy; val; val=val->next)
+ {
+ boolean specificallySelected = (val->selected && !field->allSelected);
+ // TODO do we want to stop of valuesShown exceeds FacetFieldLimit? Maybe use that or something else or nothing?
+ if ((val->selectCount > 0 && (field->showAllValues || valuesShown < FacetFieldLimit))
+ || specificallySelected)
+ {
+ ++valuesShown;
+ char *op = "add";
+ if (specificallySelected)
+ op = "remove";
+ if (sameString(op, "remove"))
+ {
+ printf("