mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Tbodysort widget enhancement. (#1312)
* Enhancement/LockTbodyHeader Added two new variables to hold the lockhead option and the head row class (defined in cssHeader). If the new widget option 'sortTbody_lockHead' is true, the header row will be moved back to the top of the <tbody> after sorting, this is intended to be used with the 'sortTbody_sortRows' option set to true. This will allow the <tbody> and it's child rows to be sorted while keeping the header row at the top of the <tbody>. * The new lockHead option now used the `sortTbody_primaryRow` value instead of the `cssHeader` value. This means the new widget option can be used out-of-the-box, meaning the user won't need to change any default parameters in the js files. * Changed setting to test old code. * Roll back to master version. * Widget sortTbodies - Removed `lockHead` var since it's only used once - Ammended `sortEnd` condition
This commit is contained in:
parent
f8a205cddc
commit
43979d44d9
@ -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 */
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user