mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Grouping: fix group_collapsed behavior. See #1247
This commit is contained in:
parent
f7cf68b4ad
commit
c036d0dcda
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
@ -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, '<').replace(/>/g, '>');
|
var name = ( data.currentGroup || '' ).replace(/</g, '<').replace(/>/g, '>');
|
||||||
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++;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user