Grouping: fix group_collapsed behavior. See #1247

This commit is contained in:
Rob Garrison 2016-07-08 12:38:42 -05:00
parent f7cf68b4ad
commit c036d0dcda
2 changed files with 5 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -155,7 +155,6 @@
if ( wo.group_saveGroups && if ( wo.group_saveGroups &&
!$.isEmptyObject( wo.group_collapsedGroups ) && !$.isEmptyObject( wo.group_collapsedGroups ) &&
wo.group_collapsedGroups[ wo.group_collapsedGroup ].length ) { wo.group_collapsedGroups[ wo.group_collapsedGroup ].length ) {
name = $row.find( '.group-name' ).text().toLowerCase() + $row.attr( 'data-group-index' ); name = $row.find( '.group-name' ).text().toLowerCase() + $row.attr( 'data-group-index' );
isHidden = $.inArray( name, wo.group_collapsedGroups[ wo.group_collapsedGroup ] ) > -1; isHidden = $.inArray( name, wo.group_collapsedGroups[ wo.group_collapsedGroup ] ) > -1;
$row.toggleClass( 'collapsed', isHidden ); $row.toggleClass( 'collapsed', isHidden );
@ -171,7 +170,7 @@
var name = ( data.currentGroup || '' ).replace(/</g, '&lt;').replace(/>/g, '&gt;'); var name = ( data.currentGroup || '' ).replace(/</g, '&lt;').replace(/>/g, '&gt;');
return '<tr class="group-header ' + c.selectorRemove.slice(1) + return '<tr class="group-header ' + c.selectorRemove.slice(1) +
'" unselectable="on" ' + ( c.tabIndex ? 'tabindex="0" ' : '' ) + 'data-group-index="' + '" unselectable="on" ' + ( c.tabIndex ? 'tabindex="0" ' : '' ) + 'data-group-index="' +
( data.groupIndex++ ) + '">' + data.groupIndex + '">' +
'<td colspan="' + c.columns + '">' + '<td colspan="' + c.columns + '">' +
( wo.group_collapsible ? '<i/>' : '' ) + ( wo.group_collapsible ? '<i/>' : '' ) +
'<span class="group-name">' + name + '</span>' + '<span class="group-name">' + name + '</span>' +
@ -233,9 +232,10 @@
} }
data.$row.before( tsg.groupHeaderHTML( c, wo, data ) ); data.$row.before( tsg.groupHeaderHTML( c, wo, data ) );
if ( wo.group_saveGroups && !data.savedGroup && wo.group_collapsed && wo.group_collapsible ) { if ( wo.group_saveGroups && !data.savedGroup && wo.group_collapsed && wo.group_collapsible ) {
// all groups start collapsed // all groups start collapsed; data.groupIndex is 1 more than the expected index.
wo.group_collapsedGroups[ wo.group_collapsedGroup ].push( data.currentGroup ); wo.group_collapsedGroups[ wo.group_collapsedGroup ].push( data.currentGroup + data.groupIndex );
} }
data.groupIndex++;
} }
}, },