ac75f55fea2f69a4da8b9f6939e70b3a400301e9 kent Mon Mar 16 12:43:45 2015 -0700 Making it print numerical fields right justified. Tweaking instructiona line a little. diff --git src/hg/lib/tablesTables.c src/hg/lib/tablesTables.c index 6e3ace8..2ec4a51 100644 --- src/hg/lib/tablesTables.c +++ src/hg/lib/tablesTables.c @@ -27,38 +27,39 @@ while ((row = sqlNextRow(sr)) != NULL) fieldedTableAdd(table, row, fieldCount, ++i); sqlFreeResult(&sr); return table; } static void showTableFilterInstructionsEtc(struct fieldedTable *table, char *itemPlural, struct fieldedTableSegment *largerContext) /* Print instructional text, and basic summary info on who passes filter, and a submit * button just in case user needs it */ { /* Print info on matching */ int matchCount = slCount(table->rowList); if (largerContext != NULL) // Need to page? matchCount = largerContext->tableSize; -printf(" %d %s found. ", matchCount, itemPlural); -cgiMakeButton("submit", "update"); +cgiMakeButton("submit", "search"); +printf("   "); +printf("%d %s found. ", matchCount, itemPlural); printf("<BR>\n"); -printf("First row of table below can filter. "); -printf("Wildcard * and ? characters are allowed in text filters. "); -printf(">min or <max, is allowed in numerical fields.<BR>\n"); +printf("You can further filter search results field by field below. "); +printf("Wildcard * and ? characters are allowed in text fields. "); +printf(">min or <max are allowed in numerical fields.<BR>\n"); } static void printSuggestScript(char *id, struct slName *suggestList) /* Print out a little javascript to wrap auto-suggester around control with given ID */ { printf("<script>\n"); printf("$(document).ready(function() {\n"); printf(" $('#%s').autocomplete({\n", id); printf(" delay: 100,\n"); printf(" minLength: 0,\n"); printf(" source: ["); char *separator = ""; struct slName *suggest; for (suggest = suggestList; suggest != NULL; suggest = suggest->next) { @@ -199,52 +200,60 @@ if (field[0] == '-') { field += 1; doReverse = TRUE; } fieldedTableSortOnField(table, field, doReverse); } } static void showTableDataRows(struct fieldedTable *table, int pageSize, int maxLenField, struct hash *tagOutputWrappers, void *wrapperContext) /* Render data rows into HTML */ { int count = 0; struct fieldedRow *row; +boolean isNum[table->fieldCount]; +int i; +for (i=0; i<table->fieldCount; ++i) + isNum[i] = fieldedTableColumnIsNumeric(table, i); + for (row = table->rowList; row != NULL; row = row->next) { if (++count > pageSize) break; printf("<TR>\n"); int fieldIx = 0; for (fieldIx=0; fieldIx<table->fieldCount; ++fieldIx) { char shortVal[maxLenField+1]; char *longVal = emptyForNull(row->row[fieldIx]); char *val = longVal; int valLen = strlen(val); if (maxLenField > 0 && maxLenField < valLen) { if (valLen > maxLenField) { memcpy(shortVal, val, maxLenField-3); shortVal[maxLenField-3] = 0; strcat(shortVal, "..."); val = shortVal; } } + if (isNum[fieldIx]) + webPrintLinkCellRightStart(); + else webPrintLinkCellStart(); boolean printed = FALSE; if (tagOutputWrappers != NULL && !isEmpty(val)) { char *field = table->fields[fieldIx]; webTableOutputWrapperType *printer = hashFindVal(tagOutputWrappers, field); if (printer != NULL) { printer(table, row, field, longVal, val, wrapperContext); printed = TRUE; } } if (!printed) printf("%s", val);