Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tbodysort widget enhancement. #1312

Merged
merged 5 commits into from Nov 17, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion js/widgets/widget-sortTbodies.js
@@ -1,6 +1,7 @@
/*! tablesorter tbody sorting widget (BETA) - 11/22/2015 (v2.24.6)
/*! tablesorter tbody sorting widget (BETA) - 11/07/2016 (v2.24.7)
* Requires tablesorter v2.22.2+ and jQuery 1.4+
* by Rob Garrison
* Contributors: Chris Rogers
*/
/*jshint browser:true, jquery:true, unused:false */
/*global jQuery: false */
Expand Down Expand Up @@ -38,6 +39,16 @@
// find parsers for each column
ts.sortTbodies.setTbodies( c, wo );
ts.updateCache( c, null, c.$tbodies );
})
.bind('sortEnd', function() {
// Moves the head row back to the top of the tbody
var primaryRow = wo.sortTbody_primaryRow;

if ( wo.sortTbody_lockHead && primaryRow ) {
c.$table.find( primaryRow ).each( function(){
$( this ).parents( 'tbody' ).prepend( this );
});
}
});

// detect parsers - in case the table contains only info-only tbodies
Expand Down