Notes
- 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.
Options
Group widget default options (added inside of tablesorter widgetOptions
)
TIP! Click on the link in the option column to reveal full details (or toggle|show|hide all) or double click to update the browser location.
Option | Default | Description |
---|---|---|
staticRow_class | ".static" |
Set a class name to use to lock a row in place, include a period. |
staticRow_data | "static-index" |
Set the jQuery data name to use with the row element. This data name saves the row index, and is only available as an option to avoid conflicts. |
staticRow_index | "row-index" |
Use this data-attribute to set the desired static row location
Set the desired location using either of these two methods:
If these values are changed dynamically, the static row location can be updated |
Methods / Events
Method
If adding or removing rows from the table, using any of the update methods will automatically refresh the static row indexes. Use the "Add Row" button below to test this.To modify or refresh the static row indexing without updating, trigger a
staticRowsRefresh
event on the table:
var $row = $("tr:contains('Iguana')"); // move Iguana row down one (remember, this only works on static rows) $row.data('row-index', $row.data('row-index') + 1); $(table).trigger('staticRowsRefresh');this allows moving a static row dynamically; try the Move "Ignuana" row buttons above the "Single tbody" demo.
Event
AstaticRowsComplete
event is triggered after the static rows widget has completed moving the static rows back into place. Use it as follows:
$(table).bind('staticRowsComplete', function(table){ console.log('static rows applied to ' + table.id); });
Demo
Single tbody
Move "Iguana" row:
Column 1 | Column 2 | Column 3 |
---|---|---|
Column 1 | Column 2 | Column 3 |
D | 4 | Dog |
E | 5 | Emu |
F | 6 | Frog |
G | 7 | Goat |
A | 1 | Anteater |
B | 2 | Bear |
C | 3 | Cat |
H | 8 | Horse |
I | 9 | Iguana |
J | 10 | Jellyfish |
V | 22 | Vole |
W | 23 | Walrus |
X | 24 | Xantis |
K | 11 | Koala |
L | 12 | Lemur |
Q | 17 | Quail |
R | 18 | Rhino |
S | 19 | Seal |
M | 13 | Mink |
N | 14 | Nightingale |
O | 15 | Octopus |
P | 16 | Pig |
T | 20 | Tiger |
U | 21 | Urchin |
Y | 25 | Yak |
Z | 26 | Zebra |
Total Count | Lots! |
Multiple tbody
Rank | First Name | Last Name | Age | Total | Discount | Date |
---|---|---|---|---|---|---|
1 | Philip Aaron Wong | Johnson Sr Esq | 25 | $5.95 | 22% | Jun 26, 2004 7:22 AM |
11 | Aaron | Hibert | 12 | $2.99 | 5% | Aug 21, 2009 12:21 PM |
12 | Brandon Clark | Henry Jr | 51 | $42.29 | 18% | Oct 13, 2000 1:15 PM |
111 | Peter | Parker | 28 | $9.99 | 20% | Jul 6, 2006 8:14 AM |
21 | John | Hood | 33 | $19.99 | 25% | Dec 10, 2002 5:14 AM |
013 | Clark | Kent Sr. | 18 | $15.89 | 44% | Jan 12, 2003 11:14 AM |
Second tbody | ||||||
005 | Bruce | Almighty Esq | 45 | $153.19 | 44% | Jan 18, 2021 9:12 AM |
10 | Alex | Dumass | 13 | $5.29 | 4% | Jan 8, 2012 5:11 PM |
16 | Jim | Franco | 24 | $14.19 | 14% | Jan 14, 2004 11:23 AM |
166 | Bruce Lee | Evans | 22 | $13.19 | 11% | Jan 18, 2007 9:12 AM |
100 | Brenda Dexter | McMasters | 18 | $55.20 | 15% | Feb 12, 2010 7:23 PM |
55 | Dennis | Bronson | 65 | $123.00 | 32% | Jan 20, 2001 1:12 PM |
9 | Martha | delFuego | 25 | $22.09 | 17% | Jun 11, 2011 10:55 AM |