16688d8516353f5230f11de5e5397f728b78643c
max
  Wed Oct 2 02:45:22 2024 -0700
fixing move to bottom not working after cart reset, refs #23793

diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index 1851b9e..d90c29c 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -2118,42 +2118,37 @@
  //// rightClick (aka context menu) ////
 ///////////////////////////////////////
 var rightClick = {
 
     menu: null,
     selectedMenuItem: null,   // currently choosen context menu item (via context menu).
     floatingMenuItem: null,
     currentMapItem:   null,
     supportZoomCodon: true,  // add zoom to exon and zoom to codon to right click menu
     clickedHighlightIdx : null,  // the index (0,1,...) of the highlight item that overlaps the last right-click
 
     moveTo : function(id, topOrBottom) {
         /* move a track to either "top" or "bottom" position */
         let newPos = "-1";
         if (topOrBottom==="bottom") {
-            //newPos = String(parseInt($(".trDraggable").last().attr("abbr"))+1);
-            newPos = 9999;
+            newPos = String(parseInt($(".imgOrd").last().attr("abbr"))+1);
         }
 
         let trEl = $(document.getElementById('tr_' + id));
         trEl.attr('abbr', newPos);
 
         dragReorder.sort($("#imgTbl"));
-        //cart.setVarsObj({},null,false);
-
-        // The C code seems to assume that the track order is linearly increasing, so fix that up now
-
         dragReorder.setOrder($("#imgTbl"));
     },
     hideTracks: function (ids) 
     {
         var cartVars = [];
         var cartVals = [];
 
         for (var i = 0; i<ids.length; i++) {
             var id = ids[i];
             var rec = hgTracks.trackDb[id];
             if (tdbIsSubtrack(rec)) {
                 // Remove subtrack level vis and explicitly uncheck.
                 //cart.setVars( [ id, id+"_sel" ], [ '[]', 0 ] ); 
                 cartVars.push(id);
                 cartVals.push('[]');