mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
fixed issue #179 - using addRows on an empty table
This commit is contained in:
parent
57d892ca72
commit
9a5bc0e0c4
@ -1,5 +1,5 @@
|
|||||||
/*!
|
/*!
|
||||||
* TableSorter 2.4.8 - Client-side table sorting with ease!
|
* TableSorter 2.5 - Client-side table sorting with ease!
|
||||||
* @requires jQuery v1.2.6+
|
* @requires jQuery v1.2.6+
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007 Christian Bach
|
* Copyright (c) 2007 Christian Bach
|
||||||
@ -14,7 +14,7 @@
|
|||||||
* @author Christian Bach/christian.bach@polyester.se
|
* @author Christian Bach/christian.bach@polyester.se
|
||||||
* @contributor Rob Garrison/https://github.com/Mottie/tablesorter
|
* @contributor Rob Garrison/https://github.com/Mottie/tablesorter
|
||||||
*/
|
*/
|
||||||
/*jshint evil:true, browser:true, jquery:true, unused:false */
|
/*jshint browser:true, jquery:true, unused:false */
|
||||||
/*global console:false, alert:false */
|
/*global console:false, alert:false */
|
||||||
!(function($) {
|
!(function($) {
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
var ts = this;
|
var ts = this;
|
||||||
|
|
||||||
ts.version = "2.4.8";
|
ts.version = "2.5";
|
||||||
|
|
||||||
ts.parsers = [];
|
ts.parsers = [];
|
||||||
ts.widgets = [];
|
ts.widgets = [];
|
||||||
@ -449,7 +449,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sort multiple columns
|
// sort multiple columns
|
||||||
function multisort(table) {
|
function multisort(table) { /*jshint loopfunc:true */
|
||||||
var dynamicExp, sortWrapper, col, mx = 0, dir = 0, tc = table.config,
|
var dynamicExp, sortWrapper, col, mx = 0, dir = 0, tc = table.config,
|
||||||
sortList = tc.sortList, l = sortList.length, bl = table.tBodies.length,
|
sortList = tc.sortList, l = sortList.length, bl = table.tBodies.length,
|
||||||
sortTime, i, j, k, c, cache, lc, s, e, order, orgOrderCol;
|
sortTime, i, j, k, c, cache, lc, s, e, order, orgOrderCol;
|
||||||
@ -704,6 +704,10 @@
|
|||||||
var i, rows = $row.filter('tr').length,
|
var i, rows = $row.filter('tr').length,
|
||||||
dat = [], l = $row[0].cells.length, t = this,
|
dat = [], l = $row[0].cells.length, t = this,
|
||||||
tbdy = $(this).find('tbody').index( $row.closest('tbody') );
|
tbdy = $(this).find('tbody').index( $row.closest('tbody') );
|
||||||
|
// fixes adding rows to an empty table - see issue #179
|
||||||
|
if (!c.parsers) {
|
||||||
|
c.parsers = buildParserCache(t);
|
||||||
|
}
|
||||||
// add each row
|
// add each row
|
||||||
for (i = 0; i < rows; i++) {
|
for (i = 0; i < rows; i++) {
|
||||||
// add each cell
|
// add each cell
|
||||||
@ -1305,6 +1309,7 @@
|
|||||||
row = 0;
|
row = 0;
|
||||||
$tv = $tb.children('tr:visible');
|
$tv = $tb.children('tr:visible');
|
||||||
// revered back to using jQuery each - strangely it's the fastest method
|
// revered back to using jQuery each - strangely it's the fastest method
|
||||||
|
/*jshint loopfunc:true */
|
||||||
$tv.each(function(){
|
$tv.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
|
||||||
|
Loading…
Reference in New Issue
Block a user