updateCell now removes extra rows to ensure correct cell indexing

This commit is contained in:
Mottie 2013-02-28 10:03:23 -06:00
parent eaa39e731f
commit bde4482241

View File

@ -713,7 +713,7 @@
}) })
.bind("update.tablesorter updateRows.tablesorter", function(e, resort, callback) { .bind("update.tablesorter updateRows.tablesorter", function(e, resort, callback) {
// remove rows/elements before update // remove rows/elements before update
$(c.selectorRemove, $t0).remove(); $this.find(c.selectorRemove).remove();
// rebuild parsers // rebuild parsers
c.parsers = buildParserCache($t0); c.parsers = buildParserCache($t0);
// rebuild the cache map // rebuild the cache map
@ -721,6 +721,7 @@
checkResort($this, resort, callback); checkResort($this, resort, callback);
}) })
.bind("updateCell.tablesorter", function(e, cell, resort, callback) { .bind("updateCell.tablesorter", function(e, cell, resort, callback) {
$this.find(c.selectorRemove).remove();
// get position from the dom // get position from the dom
var l, row, icell, var l, row, icell,
$tb = $this.find('tbody'), $tb = $this.find('tbody'),
@ -733,9 +734,9 @@
if ($tb.length && tbdy >= 0) { if ($tb.length && tbdy >= 0) {
row = $tb.eq(tbdy).find('tr').index( $row ); row = $tb.eq(tbdy).find('tr').index( $row );
icell = cell.cellIndex; icell = cell.cellIndex;
l = $t0.config.cache[tbdy].normalized[row].length - 1; l = c.cache[tbdy].normalized[row].length - 1;
$t0.config.cache[tbdy].row[$t0.config.cache[tbdy].normalized[row][l]] = $row; c.cache[tbdy].row[$t0.config.cache[tbdy].normalized[row][l]] = $row;
$t0.config.cache[tbdy].normalized[row][icell] = c.parsers[icell].format( getElementText($t0, cell, icell), $t0, cell, icell ); c.cache[tbdy].normalized[row][icell] = c.parsers[icell].format( getElementText($t0, cell, icell), $t0, cell, icell );
checkResort($this, resort, callback); checkResort($this, resort, callback);
} }
}) })