From 3aa474012d2157b41f2d647288c2721b97e94d46 Mon Sep 17 00:00:00 2001 From: Mottie Date: Tue, 2 Sep 2014 09:23:41 -0500 Subject: [PATCH] Zebra: apply style one row. Fixes #715 --- js/jquery.tablesorter.js | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index 5111a9b6..2d10cc8c 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -1863,21 +1863,18 @@ } for (k = 0; k < b.length; k++ ) { // loop through the visible rows + row = 0; $tb = b.eq(k); - l = $tb.children('tr').length; - if (l > 1) { - row = 0; - $tv = $tb.children('tr:visible').not(c.selectorRemove); - // revered back to using jQuery each - strangely it's the fastest method - /*jshint loopfunc:true */ - $tv.each(function(){ - $tr = $(this); - // style children rows the same way the parent row was styled - if (!child.test(this.className)) { row++; } - even = (row % 2 === 0); - $tr.removeClass(wo.zebra[even ? 1 : 0]).addClass(wo.zebra[even ? 0 : 1]); - }); - } + $tv = $tb.children('tr:visible').not(c.selectorRemove); + // revered back to using jQuery each - strangely it's the fastest method + /*jshint loopfunc:true */ + $tv.each(function(){ + $tr = $(this); + // style child rows the same way the parent row was styled + if (!child.test(this.className)) { row++; } + even = (row % 2 === 0); + $tr.removeClass(wo.zebra[even ? 1 : 0]).addClass(wo.zebra[even ? 0 : 1]); + }); } if (c.debug) { ts.benchmark("Applying Zebra widget", time);