• In v2.19.1, the staticRow_event option was added.

  • This widget will only work in tablesorter version 2.8+.
  • The widget was modified from Tablesorter-Static-Row-Plugin by ascii-soup (MIT license).
  • It has been updated to work in tables with multiple tbodies, but not within information-only tbodies.
  • This widget was not tested, nor was it meant to be used with the pager.
  • Note This demo was updated to allow toggling of static rows.

Demo

Note Make any row static or normal by toggling the static class name using Ctrl + left click ( + click on Mac)

Single tbody

Move "Iguana" row:

Column 1
Column 2
Column 3
D4Dog
E5Emu
F6Frog
G7Goat
A1Anteater
B2Bear
C3Cat
H8Horse
I9Iguana
J10Jellyfish
V22Vole
W23Walrus
X24Xantis
K11Koala
Column 1Column 2Column 3
L12Lemur
Q17Quail
R18Rhino
S19Seal
M13Mink
N14Nightingale
O15Octopus
P16Pig
T20Tiger
U21Urchin
Y25Yak
Z26Zebra
Total CountLots! 

Multiple tbody

Rank
First Name
Last Name
Age
Total
Discount
Date
1Philip Aaron WongJohnson Sr Esq25$5.9522%Jun 26, 2004 7:22 AM
11AaronHibert12$2.995%Aug 21, 2009 12:21 PM
12Brandon ClarkHenry Jr51$42.2918%Oct 13, 2000 1:15 PM
111PeterParker28$9.9920%Jul 6, 2006 8:14 AM
21JohnHood33$19.9925%Dec 10, 2002 5:14 AM
013ClarkKent Sr.18$15.8944%Jan 12, 2003 11:14 AM
Second tbody
005BruceAlmighty Esq45$153.1944%Jan 18, 2021 9:12 AM
10AlexDumass13$5.294%Jan 8, 2012 5:11 PM
16JimFranco24$14.1914%Jan 14, 2004 11:23 AM
166Bruce LeeEvans22$13.1911%Jan 18, 2007 9:12 AM
100Brenda DexterMcMasters18$55.2015%Feb 12, 2010 7:23 PM
55DennisBronson65$123.0032%Jan 20, 2001 1:12 PM
9MarthadelFuego25$22.0917%Jun 11, 2011 10:55 AM

Javascript

$(function() {

$('#alphimals, #table2').tablesorter({
theme: 'blue',
widgets: ['zebra', 'staticRow']
})
// (ctrl or mac command) + click to toggle static row
.find('tbody tr').click(function(event){
if (event.ctrlKey || event.metaKey) {
$(this)
.toggleClass('static')
.trigger('staticRowsRefresh');
}
});

$('.addrow').click(function(){
$('#alphimals tbody')
.append('<tr><td>AA</td><td>0</td><td>Aardvark</td></tr>')
.trigger('update');
});

// move row up or down
$('.move').click(function(){
var direction = $(this).hasClass('up'),
$rows = $('#alphimals tr'),
$ig = $rows.filter(':contains(Iguana)').addClass('static'),
len = $rows.length - 3, // subtract two because there are two other static rows
v = $ig.data('row-index');
v = direction ? --v : ++v;
v = v > len ? len : v <= 0 ? 0 : v;
$ig.data('row-index', v);
$rows.trigger('staticRowsRefresh');
});

});

CSS

#alphimals td {
text-align: center;
}
.tablesorter tbody tr.static td {
background-color: #999;
color: #fff;
}

HTML

<h3>Single tbody</h3>
<p><button class="addrow">Add Row</button> Move "Iguana" row: <button class="move up">up</button> <button class="move">down</button></p><p>
</p><table id="alphimals" class="tablesorter">
<thead>
<tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr>
</thead>
<tbody>
<tr class="static" data-row-index="50%"><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr>
<tr><td>D</td><td>4</td><td>Dog</td></tr>
<tr><td>E</td><td>5</td><td>Emu</td></tr>
<tr><td>F</td><td>6</td><td>Frog</td></tr>
<tr><td>G</td><td>7</td><td>Goat</td></tr>
<tr><td>A</td><td>1</td><td>Anteater</td></tr>
<tr><td>B</td><td>2</td><td>Bear</td></tr>
<tr><td>C</td><td>3</td><td>Cat</td></tr>
<tr><td>H</td><td>8</td><td>Horse</td></tr>
<!-- index of next row set to one less because of static row above set to 50% -->
<tr class="static" data-row-index="8"><td>I</td><td>9</td><td>Iguana</td></tr>
<tr><td>J</td><td>10</td><td>Jellyfish</td></tr>
<tr><td>V</td><td>22</td><td>Vole</td></tr>
<tr><td>W</td><td>23</td><td>Walrus</td></tr>
<tr><td>X</td><td>24</td><td>Xantis</td></tr>
<tr><td>K</td><td>11</td><td>Koala</td></tr>
<tr><td>L</td><td>12</td><td>Lemur</td></tr>
<tr><td>Q</td><td>17</td><td>Quail</td></tr>
<tr><td>R</td><td>18</td><td>Rhino</td></tr>
<tr><td>S</td><td>19</td><td>Seal</td></tr>
<tr><td>M</td><td>13</td><td>Mink</td></tr>
<tr><td>N</td><td>14</td><td>Nightingale</td></tr>
<tr><td>O</td><td>15</td><td>Octopus</td></tr>
<tr><td>P</td><td>16</td><td>Pig</td></tr>
<tr><td>T</td><td>20</td><td>Tiger</td></tr>
<tr><td>U</td><td>21</td><td>Urchin</td></tr>
<tr><td>Y</td><td>25</td><td>Yak</td></tr>
<tr><td>Z</td><td>26</td><td>Zebra</td></tr>
<tr class="static" data-row-index="50"><td>Total Count</td><td>Lots!</td><td> </td></tr>
</tbody>
</table>

<h4>Multiple tbody</h4>
<table id="table2" class="tablesorter">
<thead>
<tr>
<th>Rank</th>
<th>First Name</th>
<th>Last Name</th>
<th>Age</th>
<th>Total</th>
<th>Discount</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr><td>1</td><td>Philip Aaron Wong</td><td>Johnson Sr Esq</td><td>25</td><td>$5.95</td><td>22%</td><td>Jun 26, 2004 7:22 AM</td></tr>
<tr><td>11</td><td>Aaron</td><td>Hibert</td><td>12</td><td>$2.99</td><td>5%</td><td>Aug 21, 2009 12:21 PM</td></tr>
<tr class="static"><td>12</td><td>Brandon Clark</td><td>Henry Jr</td><td>51</td><td>$42.29</td><td>18%</td><td>Oct 13, 2000 1:15 PM</td></tr>
<tr><td>111</td><td>Peter</td><td>Parker</td><td>28</td><td>$9.99</td><td>20%</td><td>Jul 6, 2006 8:14 AM</td></tr>
<tr><td>21</td><td>John</td><td>Hood</td><td>33</td><td>$19.99</td><td>25%</td><td>Dec 10, 2002 5:14 AM</td></tr>
<tr><td>013</td><td>Clark</td><td>Kent Sr.</td><td>18</td><td>$15.89</td><td>44%</td><td>Jan 12, 2003 11:14 AM</td></tr>
</tbody>
<tbody class="tablesorter-infoOnly">
<tr><th colspan="7">Second tbody</th></tr>
</tbody>
<tbody>
<tr><td>005</td><td>Bruce</td><td>Almighty Esq</td><td>45</td><td>$153.19</td><td>44%</td><td>Jan 18, 2021 9:12 AM</td></tr>
<tr><td>10</td><td>Alex</td><td>Dumass</td><td>13</td><td>$5.29</td><td>4%</td><td>Jan 8, 2012 5:11 PM</td></tr>
<tr><td>16</td><td>Jim</td><td>Franco</td><td>24</td><td>$14.19</td><td>14%</td><td>Jan 14, 2004 11:23 AM</td></tr>
<tr><td>166</td><td>Bruce Lee</td><td>Evans</td><td>22</td><td>$13.19</td><td>11%</td><td>Jan 18, 2007 9:12 AM</td></tr>
<tr><td>100</td><td>Brenda Dexter</td><td>McMasters</td><td>18</td><td>$55.20</td><td>15%</td><td>Feb 12, 2010 7:23 PM</td></tr>
<tr><td>55</td><td>Dennis</td><td>Bronson</td><td>65</td><td>$123.00</td><td>32%</td><td>Jan 20, 2001 1:12 PM</td></tr>
<tr class="static"><td>9</td><td>Martha</td><td>delFuego</td><td>25</td><td>$22.09</td><td>17%</td><td>Jun 11, 2011 10:55 AM</td></tr>
</tbody>
</table>