18cb96eaa4c57791cf9df208edd326df2aafca5b
tdreszer
  Thu Dec 16 14:55:35 2010 -0800
Move drag and drop registration to utils because this needs to be reregistered after a sort.
diff --git src/hg/js/hui.js src/hg/js/hui.js
index 2589e18..1248533 100644
--- src/hg/js/hui.js
+++ src/hg/js/hui.js
@@ -1046,47 +1046,34 @@
 }
 
 function tableSortAtButtonPress(anchor,tagId)
 { // Special ONLY for hgTrackUi sorting.  Others use utils.js::tableSortOnButtonPress()
     var table = $( anchor ).parents("table.sortable");
     if (table) {
         subtrackCfgHideAll(table);
         waitOnFunction( _tableSortOnButtonPressEncapsulated, anchor, tagId);
     }
     return false;  // called by link so return false means don't try to go anywhere
 }
 
 // The following js depends upon the jQuery library
 $(document).ready(function()
 {
-    //jQuery.each(jQuery.browser, function(i, val) {
-    //    if(val) {
-    //        browser = i;
-    //    }
-    //});
+    // Initialize sortable tables
+    $('table.sortable').each(function (ix) {
+        sortTableInitialize(this,true,true);
+    });
 
-    // Allows rows to have their positions updated after a drag event
-    var tblDnd = $(".tableWithDragAndDrop");
-    if($(tblDnd).length > 0) {
-        $(tblDnd).tableDnD({
-            onDragClass: "trDrag",
-            dragHandle: "dragHandle",
-            onDrop: function(table, row, dragStartIndex) {
-                    if(tableSetPositions) {
-                        tableSetPositions(table);
-                    }
-                }
+    // Register tables with drag and drop
+    $("table.tableWithDragAndDrop").each(function (ix) {
+        tableDragAndDropRegister(this);
             });
-        $("td.dragHandle").hover(
-            function(){ $(this).closest('tr').addClass('trDrag'); },
-            function(){ $(this).closest('tr').removeClass('trDrag'); }
-        );
-    }
+
     $('.halfVis').css('opacity', '0.5'); // The 1/2 opacity just doesn't get set from cgi!
 
     $('.filterComp').each( function(i) { // Do this by 'each' to set noneIsAll individually
         $(this).dropdownchecklist({ firstItemChecksAll: true, noneIsAll: $(this).hasClass('filterBy') });
     });
 
     // Put navigation links in top corner
     navigationLinksSetup();
 });