mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
sort multiple tbodies
This commit is contained in:
parent
64b63632ec
commit
28e9a07d59
@ -235,7 +235,7 @@
|
|||||||
if (e > rows.length ) {
|
if (e > rows.length ) {
|
||||||
e = rows.length;
|
e = rows.length;
|
||||||
}
|
}
|
||||||
$(table.tBodies[0]).empty();
|
$.tablesorter.clearTableBody(table);
|
||||||
for (i = s; i < e; i++) {
|
for (i = s; i < e; i++) {
|
||||||
o = rows[i];
|
o = rows[i];
|
||||||
l = o.length;
|
l = o.length;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
cssAsc: "tablesorter-headerSortUp",
|
cssAsc: "tablesorter-headerSortUp",
|
||||||
cssDesc: "tablesorter-headerSortDown",
|
cssDesc: "tablesorter-headerSortDown",
|
||||||
cssChildRow: "expand-child",
|
cssChildRow: "expand-child",
|
||||||
|
cssInfoBlock: "tablesorter-infoOnly",
|
||||||
sortInitialOrder: "asc",
|
sortInitialOrder: "asc",
|
||||||
sortMultiSortKey: "shiftKey",
|
sortMultiSortKey: "shiftKey",
|
||||||
sortForce: null,
|
sortForce: null,
|
||||||
@ -196,42 +197,44 @@
|
|||||||
|
|
||||||
/* utils */
|
/* utils */
|
||||||
function buildCache(table) {
|
function buildCache(table) {
|
||||||
var b = table.tBodies[0],
|
var b = table.tBodies,
|
||||||
totalRows = (b && b.rows.length) || 0,
|
tc = table.config,
|
||||||
totalCells = (b.rows[0] && b.rows[0].cells.length) || 0,
|
totalRows,
|
||||||
parsers = table.config.parsers,
|
totalCells,
|
||||||
cache = {
|
parsers = tc.parsers,
|
||||||
row: [],
|
|
||||||
normalized: []
|
|
||||||
},
|
|
||||||
t, i, j, c, cols, cacheTime;
|
t, i, j, c, cols, cacheTime;
|
||||||
if (table.config.debug) {
|
tc.cache = {};
|
||||||
|
if (tc.debug) {
|
||||||
cacheTime = new Date();
|
cacheTime = new Date();
|
||||||
}
|
}
|
||||||
|
for (k = 0; k < b.length; k++) {
|
||||||
|
tc.cache[k] = { row: [], normalized: [] };
|
||||||
|
totalRows = (b[k] && b[k].rows.length) || 0;
|
||||||
|
totalCells = (b[k].rows[0] && b[k].rows[0].cells.length) || 0;
|
||||||
|
|
||||||
for (i = 0; i < totalRows; ++i) {
|
for (i = 0; i < totalRows; ++i) {
|
||||||
/** Add the table data to main data array */
|
/** Add the table data to main data array */
|
||||||
c = $(b.rows[i]);
|
c = $(b[k].rows[i]);
|
||||||
cols = [];
|
cols = [];
|
||||||
// if this is a child row, add it to the last row's children and continue to the next row
|
// if this is a child row, add it to the last row's children and continue to the next row
|
||||||
if (c.hasClass(table.config.cssChildRow)) {
|
if (c.hasClass(tc.cssChildRow)) {
|
||||||
cache.row[cache.row.length - 1] = cache.row[cache.row.length - 1].add(c);
|
tc.cache[k].row[tc.cache[k].row.length - 1] = tc.cache[k].row[tc.cache[k].row.length - 1].add(c);
|
||||||
// go to the next for loop
|
// go to the next for loop
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cache.row.push(c);
|
tc.cache[k].row.push(c);
|
||||||
for (j = 0; j < totalCells; ++j) {
|
for (j = 0; j < totalCells; ++j) {
|
||||||
t = trimAndGetNodeText(table.config, c[0].cells[j], j);
|
t = trimAndGetNodeText(tc, c[0].cells[j], j);
|
||||||
// don't bother parsing if the string is empty - previously parsing would change it to zero
|
// don't bother parsing if the string is empty - previously parsing would change it to zero
|
||||||
cols.push( parsers[j].format(t, table, c[0].cells[j], j) );
|
cols.push( parsers[j].format(t, table, c[0].cells[j], j) );
|
||||||
}
|
}
|
||||||
cols.push(cache.normalized.length); // add position for rowCache
|
cols.push(tc.cache[k].normalized.length); // add position for rowCache
|
||||||
cache.normalized.push(cols);
|
tc.cache[k].normalized.push(cols);
|
||||||
}
|
}
|
||||||
if (table.config.debug) {
|
}
|
||||||
|
if (tc.debug) {
|
||||||
benchmark("Building cache for " + totalRows + " rows", cacheTime);
|
benchmark("Building cache for " + totalRows + " rows", cacheTime);
|
||||||
}
|
}
|
||||||
table.config.cache = cache;
|
|
||||||
return cache;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWidgetById(name) {
|
function getWidgetById(name) {
|
||||||
@ -259,18 +262,22 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendToTable(table, cache) {
|
function appendToTable(table) {
|
||||||
var c = table.config,
|
var c = table.config,
|
||||||
r = cache.row,
|
b = table.tBodies,
|
||||||
n = cache.normalized,
|
|
||||||
totalRows = n.length,
|
|
||||||
checkCell = totalRows ? (n[0].length - 1) : 0,
|
|
||||||
rows = [],
|
rows = [],
|
||||||
f = document.createDocumentFragment(),
|
r, n, totalRows, checkCell,
|
||||||
i, j, l, pos, appendTime;
|
f, i, j, l, pos, appendTime;
|
||||||
if (c.debug) {
|
if (c.debug) {
|
||||||
appendTime = new Date();
|
appendTime = new Date();
|
||||||
}
|
}
|
||||||
|
for (k = 0; k < b.length; k++) {
|
||||||
|
f = document.createDocumentFragment();
|
||||||
|
r = c.cache[k].row;
|
||||||
|
n = c.cache[k].normalized;
|
||||||
|
totalRows = n.length;
|
||||||
|
checkCell = totalRows ? (n[0].length - 1) : 0;
|
||||||
|
|
||||||
for (i = 0; i < totalRows; i++) {
|
for (i = 0; i < totalRows; i++) {
|
||||||
pos = n[i][checkCell];
|
pos = n[i][checkCell];
|
||||||
rows.push(r[pos]);
|
rows.push(r[pos]);
|
||||||
@ -282,7 +289,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
table.tBodies[0].appendChild(f);
|
table.tBodies[k].appendChild(f);
|
||||||
|
}
|
||||||
if (c.appender) {
|
if (c.appender) {
|
||||||
c.appender(table, rows);
|
c.appender(table, rows);
|
||||||
}
|
}
|
||||||
@ -464,11 +472,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* sorting methods - reverted sorting method back to version 2.0.3 */
|
/* sorting methods - reverted sorting method back to version 2.0.3 */
|
||||||
function multisort(table,sortList,cache) {
|
function multisort(table, sortList) {
|
||||||
var dynamicExp = "var sortWrapper = function(a,b) {",
|
var dynamicExp, col, mx = 0, dir = 0, tc = table.config,
|
||||||
col, mx = 0, dir = 0, tc = table.config, lc = cache.normalized.length,
|
l = sortList.length, bl = table.tBodies.length,
|
||||||
l = sortList.length, sortTime, i, j, c, s, e, order, orgOrderCol;
|
sortTime, i, j, c, cache, lc, s, e, order, orgOrderCol;
|
||||||
if (tc.debug) { sortTime = new Date(); }
|
if (tc.debug) { sortTime = new Date(); }
|
||||||
|
for (k = 0; k < bl; k++) {
|
||||||
|
dynamicExp = "var sortWrapper = function(a,b) {";
|
||||||
|
cache = tc.cache[k];
|
||||||
|
lc = cache.normalized.length;
|
||||||
for (i = 0; i < l; i++) {
|
for (i = 0; i < l; i++) {
|
||||||
c = sortList[i][0];
|
c = sortList[i][0];
|
||||||
order = sortList[i][1];
|
order = sortList[i][1];
|
||||||
@ -502,8 +514,8 @@
|
|||||||
dynamicExp += "}; ";
|
dynamicExp += "}; ";
|
||||||
eval(dynamicExp);
|
eval(dynamicExp);
|
||||||
cache.normalized.sort(sortWrapper); // sort using eval expression
|
cache.normalized.sort(sortWrapper); // sort using eval expression
|
||||||
|
}
|
||||||
if (tc.debug) { benchmark("Sorting on " + sortList.toString() + " and dir " + order+ " time", sortTime); }
|
if (tc.debug) { benchmark("Sorting on " + sortList.toString() + " and dir " + order+ " time", sortTime); }
|
||||||
return cache;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Natural sort modified from: http://www.webdeveloper.com/forum/showthread.php?t=107909
|
// Natural sort modified from: http://www.webdeveloper.com/forum/showthread.php?t=107909
|
||||||
@ -588,7 +600,7 @@
|
|||||||
// if no thead or tbody quit.
|
// if no thead or tbody quit.
|
||||||
if (!this.tHead || this.tBodies.length === 0) { return; }
|
if (!this.tHead || this.tBodies.length === 0) { return; }
|
||||||
// declare
|
// declare
|
||||||
var $this, $headers, cache, config,
|
var $this, $headers, config,
|
||||||
totalRows, $cell, c, i, j, k, a, s, o;
|
totalRows, $cell, c, i, j, k, a, s, o;
|
||||||
// new blank config object
|
// new blank config object
|
||||||
this.config = {};
|
this.config = {};
|
||||||
@ -605,14 +617,14 @@
|
|||||||
// try to auto detect column type, and store in tables config
|
// try to auto detect column type, and store in tables config
|
||||||
c.parsers = buildParserCache(this, $headers);
|
c.parsers = buildParserCache(this, $headers);
|
||||||
// build the cache for the tbody cells
|
// build the cache for the tbody cells
|
||||||
cache = buildCache(this);
|
buildCache(this);
|
||||||
// fixate columns if the users supplies the fixedWidth option
|
// fixate columns if the users supplies the fixedWidth option
|
||||||
fixColumnWidth(this);
|
fixColumnWidth(this);
|
||||||
// apply event handling to headers
|
// apply event handling to headers
|
||||||
// this is to big, perhaps break it out?
|
// this is to big, perhaps break it out?
|
||||||
$headers
|
$headers
|
||||||
.click(function(e) {
|
.click(function(e) {
|
||||||
totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0;
|
// totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0;
|
||||||
if (!this.sortDisabled) {
|
if (!this.sortDisabled) {
|
||||||
// Only call sortStart if sorting is enabled.
|
// Only call sortStart if sorting is enabled.
|
||||||
$this.trigger("sortStart", tbl[0]);
|
$this.trigger("sortStart", tbl[0]);
|
||||||
@ -680,7 +692,7 @@
|
|||||||
$this.trigger("sortBegin", tbl[0]);
|
$this.trigger("sortBegin", tbl[0]);
|
||||||
// set css for headers
|
// set css for headers
|
||||||
setHeadersCss($this[0], $headers, c.sortList);
|
setHeadersCss($this[0], $headers, c.sortList);
|
||||||
appendToTable($this[0], multisort($this[0], c.sortList, cache));
|
appendToTable($this[0], multisort($this[0], c.sortList));
|
||||||
// stop normal event by returning false
|
// stop normal event by returning false
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -697,45 +709,44 @@
|
|||||||
// apply easy methods that trigger binded events
|
// apply easy methods that trigger binded events
|
||||||
$this
|
$this
|
||||||
.bind("update", function(e, resort) {
|
.bind("update", function(e, resort) {
|
||||||
var t = this, c = t.config;
|
|
||||||
// remove rows/elements before update
|
// remove rows/elements before update
|
||||||
$(c.selectorRemove, t.tBodies[0]).remove();
|
$(c.selectorRemove, this).remove();
|
||||||
// rebuild parsers.
|
// rebuild parsers.
|
||||||
c.parsers = buildParserCache(t, $headers);
|
c.parsers = buildParserCache(this, $headers);
|
||||||
// rebuild the cache map
|
// rebuild the cache map
|
||||||
cache = buildCache(t);
|
buildCache(this);
|
||||||
if (resort !== false) { $this.trigger("sorton", [c.sortList]); }
|
if (resort !== false) { $this.trigger("sorton", [c.sortList]); }
|
||||||
})
|
})
|
||||||
.bind("updateCell", function(e, cell, resort) {
|
.bind("updateCell", function(e, cell, resort) {
|
||||||
// get position from the dom.
|
// get position from the dom.
|
||||||
var pos = [(cell.parentNode.rowIndex - 1), cell.cellIndex];
|
var pos = [(cell.parentNode.rowIndex - 1), cell.cellIndex],
|
||||||
// update cache - format: function(s, table, cell, cellIndex)
|
// update cache - format: function(s, table, cell, cellIndex)
|
||||||
cache.normalized[pos[0]][pos[1]] = c.parsers[pos[1]].format(getElementText(c, cell, pos[1]), $this, cell, pos[1]);
|
tbodyindex = $(cell).closest('tbody').index();
|
||||||
c.cache = cache;
|
table.cache[tbodyindex].normalized[pos[0]][pos[1]] = c.parsers[pos[1]].format(getElementText(c, cell, pos[1]), $this, cell, pos[1]);
|
||||||
if (resort !== false) { $this.trigger("sorton", [c.sortList]); }
|
if (resort !== false) { $this.trigger("sorton", [c.sortList]); }
|
||||||
})
|
})
|
||||||
.bind("addRows", function(e, row, resort) {
|
.bind("addRows", function(e, $row, resort) {
|
||||||
var i, rows = row.filter('tr').length,
|
var i, rows = $row.filter('tr').length,
|
||||||
dat = [], l = row[0].cells.length;
|
dat = [], l = $row[0].cells.length,
|
||||||
|
tbodyindex = $row.closest('tbody').index();
|
||||||
// add each row
|
// add each row
|
||||||
for (i = 0; i < rows; i++) {
|
for (i = 0; i < rows; i++) {
|
||||||
// add each cell
|
// add each cell
|
||||||
for (j = 0; j < l; j++) {
|
for (j = 0; j < l; j++) {
|
||||||
dat[j] = c.parsers[j].format(getElementText(c, row[i].cells[j], j), $this, row[i].cells[j], j );
|
dat[j] = c.parsers[j].format(getElementText(c, $row[i].cells[j], j), $this, $row[i].cells[j], j );
|
||||||
}
|
}
|
||||||
// add the row index to the end
|
// add the row index to the end
|
||||||
dat.push(cache.row.length);
|
dat.push(c.cache[tbodyindex].row.length);
|
||||||
// update cache
|
// update cache
|
||||||
cache.row.push([row[i]]);
|
c.cache[tbodyindex].row.push([$row[i]]);
|
||||||
cache.normalized.push(dat);
|
c.cache[tbodyindex].normalized.push(dat);
|
||||||
dat = [];
|
dat = [];
|
||||||
}
|
}
|
||||||
c.cache = cache;
|
|
||||||
// resort using current settings
|
// resort using current settings
|
||||||
if (resort !== false) { $this.trigger("sorton", [c.sortList]); }
|
if (resort !== false) { $this.trigger("sorton", [c.sortList]); }
|
||||||
})
|
})
|
||||||
.bind("sorton", function(e, list) {
|
.bind("sorton", function(e, list) {
|
||||||
$(this).trigger("sortStart", tbl[0]);
|
$this.trigger("sortStart", tbl[0]);
|
||||||
c.sortList = list;
|
c.sortList = list;
|
||||||
// update and store the sortlist
|
// update and store the sortlist
|
||||||
var sortList = c.sortList;
|
var sortList = c.sortList;
|
||||||
@ -744,10 +755,10 @@
|
|||||||
// set css for headers
|
// set css for headers
|
||||||
setHeadersCss(this, $headers, sortList);
|
setHeadersCss(this, $headers, sortList);
|
||||||
// sort the table and append it to the dom
|
// sort the table and append it to the dom
|
||||||
appendToTable(this, multisort(this, sortList, cache));
|
appendToTable(this, multisort(this, sortList));
|
||||||
})
|
})
|
||||||
.bind("appendCache", function () {
|
.bind("appendCache", function () {
|
||||||
appendToTable(this, cache);
|
appendToTable(this);
|
||||||
})
|
})
|
||||||
.bind("applyWidgetId", function (e, id) {
|
.bind("applyWidgetId", function (e, id) {
|
||||||
getWidgetById(id).format(this);
|
getWidgetById(id).format(this);
|
||||||
@ -769,6 +780,8 @@
|
|||||||
applyWidget(this);
|
applyWidget(this);
|
||||||
}
|
}
|
||||||
this.hasInitialized = true;
|
this.hasInitialized = true;
|
||||||
|
$this.trigger('tablesorter-initialized', this);
|
||||||
|
if (typeof c.initialized === 'function') { c.initialized(this); }
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
this.addParser = function(parser) {
|
this.addParser = function(parser) {
|
||||||
@ -807,7 +820,7 @@
|
|||||||
return (/^[\-+(]?\d*[)]?$/).test($.trim(s.replace(/[,.'\s]/g, '')));
|
return (/^[\-+(]?\d*[)]?$/).test($.trim(s.replace(/[,.'\s]/g, '')));
|
||||||
};
|
};
|
||||||
this.clearTableBody = function (table) {
|
this.clearTableBody = function (table) {
|
||||||
$(table.tBodies[0]).empty();
|
$(table.tBodies).filter(':not(.' + table.config.cssInfoBlock + ')').empty();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
@ -970,9 +983,10 @@
|
|||||||
ts.addWidget({
|
ts.addWidget({
|
||||||
id: "zebra",
|
id: "zebra",
|
||||||
format: function(table) {
|
format: function(table) {
|
||||||
var $tr, row = 0, even, time,
|
var $tr, row, even, time, k,
|
||||||
c = table.config,
|
c = table.config,
|
||||||
child = c.cssChildRow,
|
child = c.cssChildRow,
|
||||||
|
b = table.tBodies,
|
||||||
css = [ "even", "odd" ];
|
css = [ "even", "odd" ];
|
||||||
// maintain backwards compatibility
|
// maintain backwards compatibility
|
||||||
css = c.widgetZebra && c.hasOwnProperty('css') ? c.widgetZebra.css :
|
css = c.widgetZebra && c.hasOwnProperty('css') ? c.widgetZebra.css :
|
||||||
@ -980,8 +994,12 @@
|
|||||||
if (table.config.debug) {
|
if (table.config.debug) {
|
||||||
time = new Date();
|
time = new Date();
|
||||||
}
|
}
|
||||||
|
for (k = 0; k < b.length; k++ ) {
|
||||||
|
row = 0;
|
||||||
// loop through the visible rows
|
// loop through the visible rows
|
||||||
$("tr:visible", table.tBodies[0]).each(function() {
|
$tr = $(b[k]).filter(':not(' + c.cssInfoBlock + ')').find('tr:visible:not(.' + c.cssInfoBlock + ')');
|
||||||
|
if ($tr.length > 1) {
|
||||||
|
$tr.each(function() {
|
||||||
$tr = $(this);
|
$tr = $(this);
|
||||||
// style children rows the same way the parent row was styled
|
// style children rows the same way the parent row was styled
|
||||||
if (!$tr.hasClass(child)) { row++; }
|
if (!$tr.hasClass(child)) { row++; }
|
||||||
@ -990,6 +1008,8 @@
|
|||||||
.removeClass(css[even ? 1 : 0])
|
.removeClass(css[even ? 1 : 0])
|
||||||
.addClass(css[even ? 0 : 1]);
|
.addClass(css[even ? 0 : 1]);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
if (table.config.debug) {
|
if (table.config.debug) {
|
||||||
$.tablesorter.benchmark("Applying Zebra widget", time);
|
$.tablesorter.benchmark("Applying Zebra widget", time);
|
||||||
}
|
}
|
||||||
|
@ -125,8 +125,9 @@ $.tablesorter.addWidget({
|
|||||||
$.tablesorter.addWidget({
|
$.tablesorter.addWidget({
|
||||||
id: "columns",
|
id: "columns",
|
||||||
format: function(table) {
|
format: function(table) {
|
||||||
var $td, time, i, last, rmv,
|
var $tr, $td, time, i, last, rmv, k,
|
||||||
c = table.config,
|
c = table.config,
|
||||||
|
b = table.tBodies,
|
||||||
list = c.sortList,
|
list = c.sortList,
|
||||||
len = list.length,
|
len = list.length,
|
||||||
css = [ "primary", "secondary", "tertiary" ]; // default options
|
css = [ "primary", "secondary", "tertiary" ]; // default options
|
||||||
@ -140,8 +141,10 @@ $.tablesorter.addWidget({
|
|||||||
}
|
}
|
||||||
// check if there is a sort (on initialization there may not be one)
|
// check if there is a sort (on initialization there may not be one)
|
||||||
if (list && list[0]) {
|
if (list && list[0]) {
|
||||||
|
for (k = 0; k < b.length; k++ ) {
|
||||||
// loop through the visible rows
|
// loop through the visible rows
|
||||||
$("tr:visible", table.tBodies[0]).each(function (i) {
|
$tr = $(b[k]).filter(':not(' + c.cssInfoBlock + ')').find('tr:visible:not(.' + c.cssInfoBlock + ')');
|
||||||
|
$tr.each(function (i) {
|
||||||
$td = $(this).children().removeClass(rmv);
|
$td = $(this).children().removeClass(rmv);
|
||||||
// primary sort column class
|
// primary sort column class
|
||||||
$td.eq(list[0][0]).addClass(css[0]);
|
$td.eq(list[0][0]).addClass(css[0]);
|
||||||
@ -152,9 +155,10 @@ $.tablesorter.addWidget({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// remove all column classes if sort is cleared (sortReset)
|
// remove all column classes if sort is cleared (sortReset)
|
||||||
$("td", table.tBodies[0]).removeClass(rmv);
|
$("td", table).removeClass(rmv);
|
||||||
}
|
}
|
||||||
if (c.debug) {
|
if (c.debug) {
|
||||||
$.tablesorter.benchmark("Applying Columns widget", time);
|
$.tablesorter.benchmark("Applying Columns widget", time);
|
||||||
@ -192,7 +196,7 @@ $.tablesorter.addWidget({
|
|||||||
if (v.join('') === '') {
|
if (v.join('') === '') {
|
||||||
$t.find('tr').show();
|
$t.find('tr').show();
|
||||||
} else {
|
} else {
|
||||||
$t.find('tbody').find('tr:not(.' + c.cssChildRow + ')').each(function(){
|
$t.find('tbody').find('tr:not(.' + c.cssChildRow + '):not(.' + c.cssInfoBlock + ')').each(function(){
|
||||||
r = true;
|
r = true;
|
||||||
cr = $(this).nextUntil('tr:not(.' + c.cssChildRow + ')');
|
cr = $(this).nextUntil('tr:not(.' + c.cssChildRow + ')');
|
||||||
// so, if "table.config.widgetOptions.filter_childRows" is true and there is
|
// so, if "table.config.widgetOptions.filter_childRows" is true and there is
|
||||||
@ -238,6 +242,7 @@ $.tablesorter.addWidget({
|
|||||||
css = wo.stickyHeaders || 'tablesorter-stickyHeader',
|
css = wo.stickyHeaders || 'tablesorter-stickyHeader',
|
||||||
innr = '.tablesorter-header-inner',
|
innr = '.tablesorter-header-inner',
|
||||||
firstCell = hdrCells.eq(0),
|
firstCell = hdrCells.eq(0),
|
||||||
|
tfoot = $table.find('tfoot'),
|
||||||
sticky = header.find('tr.tablesorter-header:not(.sticky-false)').clone()
|
sticky = header.find('tr.tablesorter-header:not(.sticky-false)').clone()
|
||||||
.removeClass('tablesorter-header')
|
.removeClass('tablesorter-header')
|
||||||
.addClass(css)
|
.addClass(css)
|
||||||
@ -284,7 +289,8 @@ $.tablesorter.addWidget({
|
|||||||
.scroll(function(){
|
.scroll(function(){
|
||||||
var offset = firstCell.offset(),
|
var offset = firstCell.offset(),
|
||||||
sTop = win.scrollTop(),
|
sTop = win.scrollTop(),
|
||||||
vis = ((sTop > offset.top) && (sTop < offset.top + $table.find('tbody').height())) ? 'visible' : 'hidden';
|
tableHt = $table.height() - (firstCell.height() + (tfoot.height() || 0)),
|
||||||
|
vis = (sTop > offset.top) && (sTop < offset.top + tableHt) ? 'visible' : 'hidden';
|
||||||
sticky.css({
|
sticky.css({
|
||||||
left : offset.left - win.scrollLeft(),
|
left : offset.left - win.scrollLeft(),
|
||||||
visibility : vis
|
visibility : vis
|
||||||
|
Loading…
Reference in New Issue
Block a user