diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index 4706da42..337a9f24 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 62ca0ffb..a5911aae 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 e118f189..74e9ef20 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 e32e3ed6..e1a30f7a 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 c9270143..1ecd8d10 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 e887a6f0..091d7f78 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 0110931d..468df0a3 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 82c5eeec..e844e963 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 2a83b889..85f5cde3 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 6ee1b3f6..ae62ee73 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 dc71a664..45080ff5 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 24538e9a..f15eb9ae 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 8a3c8d6a..e4c2a164 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 66bc1347..c24583a9 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 7a4f42af..ed9cb644 100644 --- a/docs/example-child-rows-filtered.html +++ b/docs/example-child-rows-filtered.html @@ -18,6 +18,10 @@ + + + +