diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index 4706da425..337a9f249 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -207,6 +207,7 @@ hideRows = function(table, p){ if (!p.ajaxUrl) { var i, + lastIndex = 0, c = table.config, rows = c.$tbodies.eq(0).children(), l = rows.length, @@ -216,9 +217,23 @@ j = 0; // size counter for ( i = 0; i < l; i++ ){ if ( !rows[i].className.match(f) ) { - rows[i].style.display = ( j >= s && j < e ) ? '' : 'none'; - // don't count child rows - j += rows[i].className.match(c.cssChildRow + '|' + c.selectorRemove.slice(1)) && !p.countChildRows ? 0 : 1; + if (j === s && rows[i].className.match(c.cssChildRow)) { + // hide child rows @ start of pager (if already visible) + rows[i].style.display = 'none'; + } else { + rows[i].style.display = ( j >= s && j < e ) ? '' : 'none'; + // don't count child rows + j += rows[i].className.match(c.cssChildRow + '|' + c.selectorRemove.slice(1)) && !p.countChildRows ? 0 : 1; + if ( j === e && rows[i].style.display !== 'none' && rows[i].className.match(ts.css.cssHasChild) ) { + lastIndex = i; + } + } + } + } + // add any attached child rows to last row of pager. Fixes part of issue #396 + if ( lastIndex > 0 && rows[lastIndex].className.match(ts.css.cssHasChild) ) { + while ( ++lastIndex < l && rows[lastIndex].className.match(c.cssChildRow) ) { + rows[lastIndex].style.display = ''; } } } @@ -457,6 +472,7 @@ for ( i = s; i < e; i++ ) { $tb.append(rows[i]); } + ts.processTbody(table, $tb, false); } diff --git a/css/theme.black-ice.css b/css/theme.black-ice.css index 62ca0ffb8..a5911aaeb 100644 --- a/css/theme.black-ice.css +++ b/css/theme.black-ice.css @@ -173,6 +173,10 @@ caption { -o-transition: height 0.1s ease; transition: height 0.1s ease; } +/* rows hidden by filtering (needed for child rows) */ +.tablesorter .filtered { + display: none; +} /* ajax error row */ .tablesorter .tablesorter-errorRow td { diff --git a/css/theme.blue.css b/css/theme.blue.css index e118f1897..74e9ef202 100644 --- a/css/theme.blue.css +++ b/css/theme.blue.css @@ -208,6 +208,10 @@ caption { -o-transition: height 0.1s ease; transition: height 0.1s ease; } +/* rows hidden by filtering (needed for child rows) */ +.tablesorter .filtered { + display: none; +} /* ajax error row */ .tablesorter .tablesorter-errorRow td { diff --git a/css/theme.bootstrap.css b/css/theme.bootstrap.css index e32e3ed60..e1a30f7a0 100644 --- a/css/theme.bootstrap.css +++ b/css/theme.bootstrap.css @@ -118,6 +118,10 @@ opacity: 0; filter: alpha(opacity=0); } +/* rows hidden by filtering (needed for child rows) */ +.tablesorter .filtered { + display: none; +} /* pager plugin */ .tablesorter-bootstrap .tablesorter-pager select { diff --git a/css/theme.bootstrap_2.css b/css/theme.bootstrap_2.css index c92701431..1ecd8d101 100644 --- a/css/theme.bootstrap_2.css +++ b/css/theme.bootstrap_2.css @@ -123,6 +123,10 @@ caption { opacity: 0; filter: alpha(opacity=0); } +/* rows hidden by filtering (needed for child rows) */ +.tablesorter .filtered { + display: none; +} /* pager plugin */ .tablesorter-bootstrap .tablesorter-pager select { diff --git a/css/theme.dark.css b/css/theme.dark.css index e887a6f03..091d7f78f 100644 --- a/css/theme.dark.css +++ b/css/theme.dark.css @@ -174,6 +174,10 @@ caption { -o-transition: height 0.1s ease; transition: height 0.1s ease; } +/* rows hidden by filtering (needed for child rows) */ +.tablesorter .filtered { + display: none; +} /* ajax error row */ .tablesorter .tablesorter-errorRow td { diff --git a/css/theme.default.css b/css/theme.default.css index 0110931d4..468df0a32 100644 --- a/css/theme.default.css +++ b/css/theme.default.css @@ -176,6 +176,10 @@ caption { -o-transition: height 0.1s ease; transition: height 0.1s ease; } +/* rows hidden by filtering (needed for child rows) */ +.tablesorter .filtered { + display: none; +} /* ajax error row */ .tablesorter .tablesorter-errorRow td { diff --git a/css/theme.dropbox.css b/css/theme.dropbox.css index 82c5eeece..e844e963d 100644 --- a/css/theme.dropbox.css +++ b/css/theme.dropbox.css @@ -199,6 +199,10 @@ caption { -o-transition: height 0.1s ease; transition: height 0.1s ease; } +/* rows hidden by filtering (needed for child rows) */ +.tablesorter .filtered { + display: none; +} /* ajax error row */ .tablesorter .tablesorter-errorRow td { diff --git a/css/theme.green.css b/css/theme.green.css index 2a83b889d..85f5cde3e 100644 --- a/css/theme.green.css +++ b/css/theme.green.css @@ -190,6 +190,10 @@ caption { -o-transition: height 0.1s ease; transition: height 0.1s ease; } +/* rows hidden by filtering (needed for child rows) */ +.tablesorter .filtered { + display: none; +} /* ajax error row */ .tablesorter .tablesorter-errorRow td { diff --git a/css/theme.grey.css b/css/theme.grey.css index 6ee1b3f6a..ae62ee733 100644 --- a/css/theme.grey.css +++ b/css/theme.grey.css @@ -232,6 +232,10 @@ caption { -o-transition: height 0.1s ease; transition: height 0.1s ease; } +/* rows hidden by filtering (needed for child rows) */ +.tablesorter .filtered { + display: none; +} /* ajax error row */ .tablesorter .tablesorter-errorRow td { diff --git a/css/theme.ice.css b/css/theme.ice.css index dc71a664d..45080ff56 100644 --- a/css/theme.ice.css +++ b/css/theme.ice.css @@ -188,6 +188,10 @@ caption { -o-transition: height 0.1s ease; transition: height 0.1s ease; } +/* rows hidden by filtering (needed for child rows) */ +.tablesorter .filtered { + display: none; +} /* ajax error row */ .tablesorter .tablesorter-errorRow td { diff --git a/css/theme.jui.css b/css/theme.jui.css index 24538e9a0..f15eb9ae9 100644 --- a/css/theme.jui.css +++ b/css/theme.jui.css @@ -141,6 +141,10 @@ -o-transition: height 0.1s ease; transition: height 0.1s ease; } +/* rows hidden by filtering (needed for child rows) */ +.tablesorter .filtered { + display: none; +} /* ajax error row */ .tablesorter .tablesorter-errorRow td { diff --git a/css/theme.less b/css/theme.less index 8a3c8d6a0..e4c2a1640 100644 --- a/css/theme.less +++ b/css/theme.less @@ -317,6 +317,10 @@ opacity: 0; filter: alpha(opacity=0); } + /* rows hidden by filtering (needed for child rows) */ + .filtered { + display: none; + } /* ajax error row */ .tablesorter-errorRow td { diff --git a/docs/css/jq.css b/docs/css/jq.css index 66bc13470..c24583a97 100644 --- a/docs/css/jq.css +++ b/docs/css/jq.css @@ -70,6 +70,7 @@ div.digg {float: right;} .next-up { padding-top: 10px; font-size: 90%; } .narrow-block { width: 50%; margin: 50px auto; } .spacer { height: 800px; } +.halfspacer { height: 400px; } .right { text-align:right; } #pager-demo th.remove { width: 20px; } /* pager demo */ #pager-demo button.remove { width: 20px; height: 20px; font-size: 10px; color: #800; } diff --git a/docs/example-child-rows-filtered.html b/docs/example-child-rows-filtered.html index 7a4f42af2..ed9cb6447 100644 --- a/docs/example-child-rows-filtered.html +++ b/docs/example-child-rows-filtered.html @@ -18,6 +18,10 @@ + + + +