9dd3d67c50a108d28803ebb50583f97718b19b35
tdreszer
  Fri May 23 13:01:37 2014 -0700
Fix bug where gene suggest was failing to make UCSC genes visible. Redmine #13304.
diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index 6441c44..ab8a445 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -605,35 +605,34 @@
     get: function (track)
     {   // return current visibility for given track
         var rec = hgTracks.trackDb[track];
         if (rec) {
             if (rec.localVisibility) {
                 return rec.localVisibility;
             } else {
                 return vis.enumOrder[rec.visibility];
             }
         } else {
             return null;
         }
     },
 
     makeTrackVisible: function (track)
-    {
+    {   // Sets the vis box to visible, and ques a cart update, but does not update the image
         if (track && vis.get(track) !== "full") {
             vis.update(track, 'pack');
-            $("<input type='hidden' name='" + track + "'value='pack'>").appendTo(
-                                                                $(document.TrackHeaderForm));
+            cart.addVarsToQueue([track], ['pack']);
         }
     },
 
     toggleForGroup: function (button, prefix)
     {   // toggle visibility of a track group; prefix is the prefix of all the id's of tr's in the
         // relevant group. This code also modifies the corresponding hidden fields and the gif
         // of the +/- img tag.
         imageV2.markAsDirtyPage();
         if (arguments.length > 2)
             return setTableRowVisibility(button, prefix, "hgtgroup", "group",false,arguments[2]);
         else
             return setTableRowVisibility(button, prefix, "hgtgroup", "group",false);
     },
 
     expandAllGroups: function (newState)
@@ -3340,30 +3339,35 @@
                 imageV2.navigateInPlace(data, null, false);
             }
             return false;
         } else {
             return true;
         }
     },
 
     navigateInPlace: function (params, disabledEle, keepCurrentTrackVisible)
     {   // request an hgTracks image, using params
         // disabledEle is optional; this element will be enabled when update is complete
         // If keepCurrentTrackVisible is true, we try to maintain relative position of the item
         // under the mouse after the in-place update.
         // Tim thinks we should consider disabling all UI input while we are doing in-place update.
         // TODO: waitOnFuction?
+    
+        // If UCSC Genes (or any suggestion) is supposed to be made visible, then do so
+        if ($("#suggestTrack").length && $('#hgFindMatches').length)
+            vis.makeTrackVisible($("#suggestTrack").val());
+
         jQuery('body').css('cursor', 'wait');
         var currentId, currentIdYOffset;
         if (keepCurrentTrackVisible) {
             var item = rightClick.currentMapItem || imageV2.lastTrack;
             if (item) {
                 var top = $(document.getElementById("tr_" + item.id)).position().top;
                 if (top >= $(window).scrollTop()
                 || top < $(window).scrollTop() + $(window).height()) {
                     // don't bother if the item is not currently visible.
                     currentId = item.id;
                     currentIdYOffset = top - $(window).scrollTop();
                 }
             }
         }
         $.ajax({