mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Group: Update header in pager with removeRows:true
. Fixes #1035
This commit is contained in:
parent
4853615569
commit
cf542ac75f
2
dist/js/widgets/widget-grouping.min.js
vendored
2
dist/js/widgets/widget-grouping.min.js
vendored
File diff suppressed because one or more lines are too long
@ -162,6 +162,7 @@ tr.group-header.collapsed td i {
|
||||
<li>Please do not use this widget in very large tables (it might be really slow) <del>or when your table includes multiple tbodies</del>.<br><br></li>
|
||||
<li>In <span class="version">v2.23.6</span>
|
||||
<ul>
|
||||
<li>This widget now works properly when used with a pager that has the `removeRows` option set to `true`.</li>
|
||||
<li>Added <code>group_time24Hour</code> (set 12 vs 24 hour time) & <code>group_dateInvalid</code> (group header text) options.</li>
|
||||
<li>Improved compatibility of the group widget with jQuery Globalize.</li>
|
||||
<li>The <code>group_months</code> option will now accept a zero or one-based array or object of month names.</li>
|
||||
@ -254,10 +255,13 @@ tr.group-header.collapsed td i {
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="group_count">
|
||||
<td><span class="permalink">group_count</span></td>
|
||||
<td><a href="#" class="permalink">group_count</a></td>
|
||||
<td><code>" ({num})"</code></td>
|
||||
<td>
|
||||
Allows you to add custom formatting, or remove, the group count within the group header. Set it to <code>false</code> or an empty string to remove the count.
|
||||
<div class="collapsible">
|
||||
<p><span class="label warning">*NOTE*</span> The value that replaces the <code>{num}</code> placeholder only counts the number of <em>visible</em> rows.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="group_separator">
|
||||
|
@ -87,7 +87,8 @@
|
||||
|
||||
update : function(table, c, wo){
|
||||
if ($.isEmptyObject(c.cache)) { return; }
|
||||
var rowIndex, tbodyIndex, currentGroup, $rows, groupClass, grouping, norm_rows, saveName, direction,
|
||||
var rowIndex, tbodyIndex, currentGroup, $row, groupClass, grouping, norm_rows, saveName, direction, end,
|
||||
hasPager = ts.hasWidget( table, 'pager' ),
|
||||
hasSort = typeof c.sortList[0] !== 'undefined',
|
||||
group = '',
|
||||
groupIndex = 0,
|
||||
@ -127,9 +128,11 @@
|
||||
for (tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++) {
|
||||
norm_rows = c.cache[tbodyIndex].normalized;
|
||||
group = ''; // clear grouping across tbodies
|
||||
$rows = c.$tbodies.eq(tbodyIndex).children('tr').not('.' + c.cssChildRow);
|
||||
for (rowIndex = 0; rowIndex < $rows.length; rowIndex++) {
|
||||
if ( $rows.eq(rowIndex).is(':visible') ) {
|
||||
rowIndex = hasPager ? c.pager.startRow - 1 : 0;
|
||||
end = hasPager ? c.pager.endRow : norm_rows.length;
|
||||
for ( ; rowIndex < end; rowIndex++ ) {
|
||||
$row = norm_rows[ rowIndex ][ c.columns ].$row;
|
||||
if ( $row.is(':visible') ) {
|
||||
// fixes #438
|
||||
if (ts.grouping.types[grouping[1]]) {
|
||||
currentGroup = norm_rows[rowIndex] ?
|
||||
@ -145,7 +148,7 @@
|
||||
if ($.isFunction(wo.group_formatter)) {
|
||||
currentGroup = wo.group_formatter((currentGroup || '').toString(), column, table, c, wo) || currentGroup;
|
||||
}
|
||||
$rows.eq(rowIndex).before('<tr class="group-header ' + c.selectorRemove.slice(1) +
|
||||
$row.before('<tr class="group-header ' + c.selectorRemove.slice(1) +
|
||||
'" unselectable="on" ' + ( c.tabIndex ? 'tabindex="0" ' : '' ) + 'data-group-index="' +
|
||||
( groupIndex++ ) + '"><td colspan="' + c.columns + '">' +
|
||||
( wo.group_collapsible ? '<i/>' : '' ) +
|
||||
|
Loading…
Reference in New Issue
Block a user