Index: misc/tabledrag.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/tabledrag.js,v
retrieving revision 1.29
diff -u -p -r1.29 tabledrag.js
--- misc/tabledrag.js	10 Jun 2009 05:06:57 -0000	1.29
+++ misc/tabledrag.js	22 Jun 2009 18:50:01 -0000
@@ -115,15 +115,13 @@ Drupal.tableDrag.prototype.hideColumns =
     }
 
     // Hide the column containing this field.
-    if (hidden && cell[0] && cell.css('display') != 'none') {
-      // Add 1 to our indexes. The nth-child selector is 1 based, not 0 based.
-      // Match immediate children of the parent element to allow nesting.
-      var columnIndex = $('> td', cell.parent()).index(cell.get(0)) + 1;
-      var headerIndex = $('> td:not(:hidden)', cell.parent()).index(cell.get(0)) + 1;
+    if (hidden && cell[0]) {
       $('> thead > tr, > tbody > tr, > tr', this.table).each(function(){
         var row = $(this);
         var parentTag = row.parent().get(0).tagName.toLowerCase();
-        var index = (parentTag == 'thead') ? headerIndex : columnIndex;
+        // Add 1 to our indexes. The nth-child selector is 1 based, not 0 based.
+        // Match immediate children of the parent element to allow nesting.
+        var index = $('> td', cell.parent()).index(cell.get(0)) + 1;
 
         // Adjust the index to take into account colspans.
         row.children().each(function (n) {
