Grouping: reapply zebra after collapsed group opens. Fixes #1156

This commit is contained in:
Rob Garrison 2016-02-15 12:39:45 -06:00
parent e2d2b472c6
commit 35df54cc03
3 changed files with 8 additions and 3 deletions

View File

@ -165,6 +165,7 @@ tr.group-header.collapsed td i {
<li>This widget will <strong>only work</strong> in tablesorter version 2.8+ and jQuery version 1.7+.</li>
<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 updated">v2.25.4</span>, the zebra widget is reapplied to the table after opening a collapsed group.</li>
<li>In <span class="version">v2.24.1</span>
<ul>
<li>Added <code>"group-text"</code> group type to the Header Class Names. This class name will use the all of the text from the cell (this would essentially be the same as using "group-word-999").</li>
@ -381,7 +382,7 @@ group_separator : /[/.]/</pre>
</tr>
<tr id="group_enforcesort">
<td><a href="#" class="permalink">group_enforceSort</a></td>
<td><span class="permalink">group_enforceSort</span></td>
<td><code>true</code></td>
<td>
Only allow <code>group_forceColumn</code> to work when a sort is applied to the table (<span class="version">v2.23.3</span>).

View File

@ -475,7 +475,7 @@
<li><span class="label label-info">Beta</span> <a href="example-widget-formatter.html">Formatter widget</a> (<span class="version">v2.19.1</span>).</li>
<li>Grouping rows widget:
<ul>
<li><a href="example-widget-grouping.html">basic</a> (v2.8; <span class="version updated">v2.24.4</span>).</li>
<li><a href="example-widget-grouping.html">basic</a> (v2.8; <span class="version updated">v2.25.4</span>).</li>
<li><a href="example-widget-grouping-filter-childrows.html">Grouping + filter + child rows</a> (<span class="updated version">v2.15.12</span>).</li>
</ul>
</li>

View File

@ -251,10 +251,14 @@
$this.toggleClass('collapsed');
// nextUntil requires jQuery 1.4+
$this.nextUntil('tr.group-header').toggleClass('group-hidden', $this.hasClass('collapsed') );
isCollapsed = $this.hasClass('collapsed');
// reapply zebra widget after opening collapsed group - see #1156
if (!isCollapsed && ts.hasWidget(c.$table, 'zebra')) {
ts.applyWidgetId(c.$table, 'zebra');
}
// save collapsed groups
if (wo.group_saveGroups && ts.storage) {
$groups = c.$table.find('.group-header');
isCollapsed = $this.hasClass('collapsed');
if (!wo.group_collapsedGroups[wo.group_collapsedGroup]) {
wo.group_collapsedGroups[wo.group_collapsedGroup] = [];
}