diff --git a/jquery.dragtable.js b/jquery.dragtable.js index 32a4f23..c69b22a 100644 --- a/jquery.dragtable.js +++ b/jquery.dragtable.js @@ -74,7 +74,8 @@ beforeStart: $.noop, // returning FALSE will stop the execution chain. beforeMoving: $.noop, beforeReorganize: $.noop, - beforeStop: $.noop + beforeStop: $.noop, + zIndex: 10 }, originalTable: { el: null, @@ -115,7 +116,7 @@ }, // bubble the moved col left or right _bubbleCols: function() { - var i, j, col1, col2; + var i, j, col1, col2, visibleRows; var from = this.originalTable.startIndex; var to = this.originalTable.endIndex; /* Find children thead and tbody. @@ -125,22 +126,23 @@ if (this.options.excludeFooter) { thtb = thtb.not('tfoot'); } + row = thtb.find('> tr'); if (from < to) { for (i = from; i < to; i++) { - col1 = thtb.find('> tr > td:nth-child(' + i + ')') - .add(thtb.find('> tr > th:nth-child(' + i + ')')); - col2 = thtb.find('> tr > td:nth-child(' + (i + 1) + ')') - .add(thtb.find('> tr > th:nth-child(' + (i + 1) + ')')); + col1 = row.find('> td:nth-child(' + i + ')') + .add(row.find('> th:nth-child(' + i + ')')); + col2 = row.find('> td:nth-child(' + (i + 1) + ')') + .add(row.find('> th:nth-child(' + (i + 1) + ')')); for (j = 0; j < col1.length; j++) { swapNodes(col1[j], col2[j]); } } } else { for (i = from; i > to; i--) { - col1 = thtb.find('> tr > td:nth-child(' + i + ')') - .add(thtb.find('> tr > th:nth-child(' + i + ')')); - col2 = thtb.find('> tr > td:nth-child(' + (i - 1) + ')') - .add(thtb.find('> tr > th:nth-child(' + (i - 1) + ')')); + col1 = row.find('> td:nth-child(' + i + ')') + .add(row.find('> th:nth-child(' + i + ')')); + col2 = row.find('> td:nth-child(' + (i - 1) + ')') + .add(row.find('> th:nth-child(' + (i - 1) + ')')); for (j = 0; j < col1.length; j++) { swapNodes(col1[j], col2[j]); } @@ -196,7 +198,7 @@ var rowAttrsArr = []; //compute height, special handling for ie needed :-( var heightArr = []; - this.originalTable.el.find('tr').slice(0, this.options.maxMovingRows).each(function(i, v) { + this.originalTable.el.find('tr:visible').slice(0, this.options.maxMovingRows).each(function(i, v) { // row attributes var attrs = this.attributes; var attrsString = ""; @@ -220,7 +222,8 @@ if (this.options.excludeFooter) { thtb = thtb.not('tfoot'); } - thtb.find('> tr > th').each(function(i, v) { + var visibleRows = thtb.find('> tr:visible'); + visibleRows.find('> th').each(function(i, v) { var w = $(this).outerWidth(); widthArr.push(w); totalWidth += w; @@ -232,15 +235,21 @@ // one extra px on right and left side totalWidth += 2 - var sortableHtml = '