cadb863ddfbcc1f97b04f0d0b8ef73db862dd060
tdreszer
  Thu Jul 28 16:32:04 2011 -0700
Fixed some hash sizes, moved some validation code from mdb.c to cv.c, added numeric sort of hgFileUi filerBy and track/file search of terms defined in cv validation as integer.
diff --git src/hg/lib/fileUi.c src/hg/lib/fileUi.c
index 7cd76df..65f2e33 100644
--- src/hg/lib/fileUi.c
+++ src/hg/lib/fileUi.c
@@ -392,31 +392,36 @@
         struct slName *vals = mdbObjsFindAllVals(mdbObjs, var);
         struct slPair *tagLabelPairs = NULL;
         while(vals != NULL)
             {
             struct slName *term = slPopHead(&vals);
             char *tag = (char *)cvTag(var,term->name);
             if (tag == NULL)
                 tag = term->name;
             slPairAdd(&tagLabelPairs,tag,cloneString((char *)cvLabel(term->name)));
             slNameFree(&term);
             }
 
         // If there is more than one val for this var then create filterBy box for it
         if (slCount(tagLabelPairs) > 1)
             {
-            slPairValSortCase(&tagLabelPairs); // should have a list sorted on the label
+            // should have a list sorted on the label
+            enum cvDataType eCvDataType = cvDataType(var);
+            if (eCvDataType == cvInteger)
+                slPairValAtoiSort(&tagLabelPairs);
+            else
+                slPairValSortCase(&tagLabelPairs);
             char extraClasses[256];
             safef(extraClasses,sizeof extraClasses,"filterTable %s",var);
         #ifdef NEW_JQUERY
             char *dropDownHtml = cgiMakeMultiSelectDropList(var,tagLabelPairs,NULL,"All",extraClasses,"onchange='filterTable(this);' style='font-size:.9em;'");
         #else///ifndef NEW_JQUERY
             char *dropDownHtml = cgiMakeMultiSelectDropList(var,tagLabelPairs,NULL,"All",extraClasses,"onchange='filterTable();' onclick='filterTableExclude(this);'");
         #endif///ndef NEW_JQUERY
             // Note filterBox has classes: filterBy & {var}
             if (dropDownHtml)
                 {
                 dyStringPrintf(dyFilters,"<td align='left'>\n<B>%s</B>:<BR>\n%s</td><td width=10>&nbsp;</td>\n",
                                labelWithVocabLink(var,sortOrder->title[sIx],tagLabelPairs,TRUE),dropDownHtml);  // TRUE were sending tags, not values
                 freeMem(dropDownHtml);
                 count++;
                 }