mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Added pager countChildRows option. See issue #396
This commit is contained in:
parent
4990460d0b
commit
c170dc6669
@ -65,6 +65,11 @@
|
||||
// table row set to a height to compensate; default is false
|
||||
fixedHeight: false,
|
||||
|
||||
// count child rows towards the set page size? (set true if it is a visible table row within the pager)
|
||||
// if true, child row(s) may not appear to be attached to its parent row, may be split across pages or
|
||||
// may distort the table if rowspan or cellspans are included.
|
||||
countChildRows: false,
|
||||
|
||||
// remove rows from the table to speed up the sort of large tables.
|
||||
// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
|
||||
removeRows: false, // removing rows in larger tables speeds up the sort
|
||||
@ -199,7 +204,7 @@
|
||||
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)) ? 0 : 1;
|
||||
j += rows[i].className.match(c.cssChildRow + '|' + c.selectorRemove.slice(1)) && !p.countChildRows ? 0 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2781,6 +2781,28 @@ $.extend($.tablesorter.themes.jui, {
|
||||
<td><a href="example-pager.html">Example</a></td>
|
||||
</tr>
|
||||
|
||||
// count child rows towards the set page size? (set true if it is a visible table row within the pager)
|
||||
// if true, child row(s) may not appear to be attached to its parent row, may be split across pages or
|
||||
// may distort the table if rowspan or cellspans are included.
|
||||
countChildRows: false,
|
||||
|
||||
<tr id="pager-countchildrows">
|
||||
<td><a href="#" class="toggle2">countChildRows</a></td>
|
||||
<td>Boolean</td>
|
||||
<td>false</td>
|
||||
<td>
|
||||
If <code>true</code>, child rows will be counted towards the pager set size (<span class="version">v2.13</span>).
|
||||
<div class="collapsible">
|
||||
<br>
|
||||
Caution: when <code>true</code>, child row(s) may not appear to be attached to its parent row, may be split across pages or
|
||||
may distort the table if rowspan or cellspans are included within the child row.<br>
|
||||
<br>
|
||||
If this option is <code>false</code>, child row(s) will always appear on the same page as its parent.
|
||||
</div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr id="pager-removerows">
|
||||
<td><a href="#" class="toggle2">removeRows</a></td>
|
||||
<td>Boolean</td>
|
||||
|
@ -29,6 +29,11 @@ ts.addWidget({
|
||||
// table row set to a height to compensate; default is false
|
||||
pager_fixedHeight: false,
|
||||
|
||||
// count child rows towards the set page size? (set true if it is a visible table row within the pager)
|
||||
// if true, child row(s) may not appear to be attached to its parent row, may be split across pages or
|
||||
// may distort the table if rowspan or cellspans are included.
|
||||
pager_countChildRows: false,
|
||||
|
||||
// remove rows from the table to speed up the sort of large tables.
|
||||
// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
|
||||
pager_removeRows: false, // removing rows in larger tables speeds up the sort
|
||||
@ -377,17 +382,18 @@ tsp = ts.pager = {
|
||||
if (!c.widgetOptions.pager_ajaxUrl) {
|
||||
var i,
|
||||
p = c.pager,
|
||||
wo = c.widgetOptions,
|
||||
rows = c.$tbodies.eq(0).children(),
|
||||
l = rows.length,
|
||||
s = ( p.page * p.size ),
|
||||
e = s + p.size,
|
||||
f = c.widgetOptions && c.widgetOptions.filter_filteredRow || 'filtered',
|
||||
f = wo && wo.filter_filteredRow || 'filtered',
|
||||
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)) ? 0 : 1;
|
||||
j += rows[i].className.match(c.cssChildRow + '|' + c.selectorRemove.slice(1)) && !wo.pager_countChildRows ? 0 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user