Notes
- In v2.21.6,
- Horizontal scrollbar now only appears on overflow.
border-box
is now applied to all tables with scroller widget applied.- Fixed columns no longer have pointer events disabled.
- Fixed column vertical scrollbar is now hidden in IE9 & older.
- Fixed tabbing through fixed column header cells & inputs.
- In v2.21.3
- * NOTE * Prior to v2.21.3, this widget would work with jQuery v1.4.4+, now it requires jQuery v1.7+.
- The scroller widget was almost completely rewritten! The functionality is the same, but it now allows the adding of fixed columns!
- Added
scroller_fixedColumns
which allows setting the number of fixed columns to add to the scroller (see options section for more details). - Added
scroller_rowHighlight
which adds a hover highlight class name to the row in both the fixed column and main table (see options section for more details). - Note:
- Yes, there are some alignment & padding issues when using the jQuery UI theme with a fixed column, I'll look into resolving this; all other themes are nearly pixel perfect.
- The fixed column widget includes extra css to prevent tbody cell content from wrapping (see the css code below); it was for demo purposes only, it is not a requirement.
- This update does not include optimizations to allow this widget to work with very large tables; so please be conscious of this fact.
- A lot of Firefox tweaks were needed to make it work! I need to investigate why the mousewheel scrolling is so slow (at least in Firefox for Windows) when a fixed column is included.
- There were lots of other tweaks to the core and other widgets (e.g. zebra & filter widgets) to get these changes to work seamlessly, so please make sure to update everything!
- In v2.21.1, columns now line up, especially while scrolling horizontally. It may not be pixel perfect, but it looks pretty good if table css "box-sizing" is set to "border-box".
- In v2.21.0
- This widget was updated to include the
tfoot
rows. - To maintain the column widths across all copied tables:
- The
widthFixed
options is now forcibly set totrue
; I apologize if this causes any inconvience. - This option adds a
<colgroup>
containing percentage width<col>
elements to each section of the scroller. - If this option does cause issues, use css to set each column width as a percentage.
- The
- This widget was updated to include the
- In v2.17+
- The scroller widget will now work properly with predefined column widths.
- Shrinking the browser window will now hide the header overflow.
- Horizontal scrolling of the table body will now properly horizontally scroll the header.
- Changed the default scroll bar width from
17
to18
. - Added
scroller_upAfterSort
option.
- This widget can not be applied to the original plugin and requires jQuery version 1.4+ to function properly; if you need to make it work with older versions of jQuery and the plugin, please use this version of the widget.
- This widget was originally written by Connell & Associates, Inc. and is dual-licensed under the MIT and GPL licenses. It has been modified to work with tablesorter version 2.9+.
Options
Scroller widget defaults (added inside of tablesorter widgetOptions
)
Option | Default | Description | ||
---|---|---|---|---|
scroller_height | 300 | Set the height of the scroll window in pixels. | ||
scroller_barWidth | null | Set the width of the scroll bar in pixels (v2.19.0)
As of v2.19.0, this option's default was changed to null because internal code was added to detect the scroll bar width which changes dramatically depending on the browser window zoom level.If you are using a custom scroll bar plugin, this option will still accept a scroll bar width value which overrides the scroll bar width auto-detection. |
||
scroller_upAfterSort | true |
When true , the scroller automatically scrolls the inner window back to the top after sorting.Set this option to false to prevent this behaviour, or to stop the window from scrolling after interacting with a table cell (e.g. clicking on a checkbox); new in v2.17.3
|
||
scroller_jumpToHeader | true | Bring the header into view while scrolling.
When * To see the difference, toggle the button in the demo below, then scroll down & up the page using a mouse wheel with the cursor at the horizontal center of the page and about 100 pixels from the top, so the cursor is within the table body. |
||
scroller_fixedColumns | 0 | This allows setting the number of fixed columns to add to the scroller (v2.21.3).
It's not 100% pixel-perfect in alignment, especially not with a jQuery UI theme, but it looks good with the other themes. If the content is set a RTL direction, add a class name of |
||
scroller_rowHighlight | "hover" | Set this to a class name to use when hovering over a fixed column row (v2.21.3).
This option adds a hover highlight class name to the hovered row in both the fixed column and main table to ensure the hover highlight shows up in both areas. If this highlighting causes unnecessary lag, it can be disabled by setting this option to an empty string. All current themes have been updated to use this class name for row highlighting; adjust any custom themes as necessary. |
||
Deprecated/Removed Options | ||||
scroller_idPrefix | "s_" | This option contains a prefix string which is added to a random number (Removed).
This option was been completely removed in v2.18.0 as the id is now obtained from the unique namespace. |
Methods
Change Fixed Column Size Dynamically
Set the number of fixed columns on any table with a scroller widget applied as follows:$( 'table' ).trigger( 'setFixedColumnSize', size );Where
Ifsize
is a value between zero and one less than the total number of columns.size
is:
- A non-integer, it will be rounded down.
- Zero or less, no fixed columns will be applied.
- Undefined, the current number of fixed columns will be refreshed.
CSS
Javascript
Demo
Choose Theme:scroller_jumpToHeader : true (see the note above)*
scroller_upAfterSort : true
Name | Major | Sex | English | Japanese | Calculus | Geometry |
---|---|---|---|---|---|---|
Name | Major | Sex | English | Japanese | Calculus | Geometry |
Student01 | Languages | male | 80 | 70 | 75 | 80 |
Student02 | Mathematics | male | 90 | 88 | 100 | 90 |
Student03 | Languages | female | 85 | 95 | 80 | 85 |
Student04 | Languages | male | 60 | 55 | 100 | 100 |
Student05 | Languages | female | 68 | 80 | 95 | 80 |
Student06 | Mathematics | male | 100 | 99 | 100 | 90 |
Student07 | Mathematics | male | 85 | 68 | 90 | 90 |
Student08 | Languages | male | 100 | 90 | 90 | 85 |
Student09 | Mathematics | male | 80 | 50 | 65 | 75 |
Student10 | Languages | male | 85 | 100 | 100 | 90 |
Student11 | Languages | male | 86 | 85 | 100 | 100 |
Student12 | Mathematics | female | 100 | 75 | 70 | 85 |
Student13 | Languages | female | 100 | 80 | 100 | 90 |
Student14 | Languages | female | 50 | 45 | 55 | 90 |
Student15 | Languages | male | 95 | 35 | 100 | 90 |
Student16 | Languages | female | 100 | 50 | 30 | 70 |
Student17 | Languages | female | 80 | 100 | 55 | 65 |
Student18 | Mathematics | male | 30 | 49 | 55 | 75 |
Student19 | Languages | male | 68 | 90 | 88 | 70 |
Student20 | Mathematics | male | 40 | 45 | 40 | 80 |
Student21 | Languages | male | 50 | 45 | 100 | 100 |
Student22 | Mathematics | male | 100 | 99 | 100 | 90 |
Student23 | Languages | female | 85 | 80 | 80 | 80 |
student23 | Mathematics | male | 82 | 77 | 0 | 79 |
student24 | Languages | female | 100 | 91 | 13 | 82 |
student25 | Mathematics | male | 22 | 96 | 82 | 53 |
student26 | Languages | female | 37 | 29 | 56 | 59 |
student27 | Mathematics | male | 86 | 82 | 69 | 23 |
student28 | Languages | female | 44 | 25 | 43 | 1 |
student29 | Mathematics | male | 77 | 47 | 22 | 38 |
student30 | Languages | female | 19 | 35 | 23 | 10 |
student31 | Mathematics | male | 90 | 27 | 17 | 50 |
student32 | Languages | female | 60 | 75 | 33 | 38 |
student33 | Mathematics | male | 4 | 31 | 37 | 15 |
student34 | Languages | female | 77 | 97 | 81 | 44 |
student35 | Mathematics | male | 5 | 81 | 51 | 95 |
student36 | Languages | female | 70 | 61 | 70 | 94 |
student37 | Mathematics | male | 60 | 3 | 61 | 84 |
student38 | Languages | female | 63 | 39 | 0 | 11 |
student39 | Mathematics | male | 50 | 46 | 32 | 38 |
student40 | Languages | female | 51 | 75 | 25 | 3 |
student41 | Mathematics | male | 43 | 34 | 28 | 78 |
student42 | Languages | female | 11 | 89 | 60 | 95 |
student43 | Mathematics | male | 48 | 92 | 18 | 88 |
student44 | Languages | female | 82 | 2 | 59 | 73 |
student45 | Mathematics | male | 91 | 73 | 37 | 39 |
student46 | Languages | female | 4 | 8 | 12 | 10 |
student47 | Mathematics | male | 89 | 10 | 6 | 11 |
student48 | Languages | female | 90 | 32 | 21 | 18 |
student49 | Mathematics | male | 42 | 49 | 49 | 72 |
student50 | Languages | female | 56 | 37 | 67 | 54 |
Account # | First Name | Last Name | Age | Total | Discount | Diff |
---|---|---|---|---|---|---|
A43 | Peter | Parker | 28 | 9.99 | 20.3% | +3 |
A255 | John | Hood | 33 | 19.99 | 25.1% | -7 |
A33 | Clark | Kent | 18 | 15.49 | 44.2% | -13 |
A11 | Bruce | Almighty | 45 | 153.19 | 44% | +19 |
A102 | Bruce | Evans | 56 | 153.19 | 23% | +9 |
A23 | Mike | Peters | 22 | 5.69 | 20.3% | +2 |
A55 | Leslie | Kent | 33 | 15.99 | 25.1% | -3 |
A3 | Frank | Mint | 44 | 12.59 | 44.2% | -12 |
A21 | Joe | Thomas | 45 | 15.25 | 44% | +12 |
A12 | Tess | Evans | 66 | 13.59 | 23% | +4 |
A21 | Peter | Dunn | 12 | 2.99 | 21.1% | +2 |
A33 | Harry | Jones | 13 | 19.49 | 22.2% | -6 |
A13 | John | James | 16 | 13.89 | 42.1% | -13 |
A71 | Nick | Parker | 45 | 13.89 | 44% | +29 |
A21 | Charles | Dunn | 19 | 15.49 | 22% | +3 |
Fixed Column Demo
(Shrink the browser window if the horizontal scrollbar is not visible)
Index | First Name | Last Name | ID | Address | State | Zip | Telephone | Notes | |
---|---|---|---|---|---|---|---|---|---|
Index | First Name | Last Name | ID | Address | State | Zip | Telephone | Notes | |
1 | Sherry | Mills | 223 | 3792 Sit Rd | NE | 69836 | (627) 124-8760 | DRamirez@massa.ly | sagittis amet mattis facilisis vitae molestie nec dolor id sed |
2 | Markella | Lessenberry | 895 | 5979 Sit Ln | VA | 97761 | (768) 233-5399 | SPeltier@pulvinar.net | elementum nullam lacus elit magna libero sed dolor pulvinar orci |
3 | Lee | Trenkelbach | 719 | 5656 Adipiscing Ave | ID | 30972 | (149) 293-0691 | LSheppard@lectus.net | vestibulum at rutrum molestie convallis vestibulum nec egestas consequat vitae |
4 | Sherrye | Llc | 908 | 2348 Pharetra St | UT | 50740 | (772) 682-4268 | MAltar@turpis.io | sit elit consequat amet elit consectetur vestibulum vel quis consequat |
5 | Juanito | Lindall | 534 | 5181 Lacus Ln | ID | 71689 | (528) 174-6999 | CKeen@augue.ly | dui porttitor vestibulum mattis ipsum nunc et morbi dolor ipsum |
6 | Andre | Fuller | 716 | 8224 Pulvinar Ave | WY | 12382 | (654) 593-0007 | AMelvin@sed.net | dolor curabitur nec molestie lacus odio id velit sed neque |
7 | Sajid | Cattanach | 997 | 3762 Ac Rd | WA | 16719 | (425) 909-2771 | BMaas@ac.org | morbi tincidunt ac sollicitudin nec ac orci vitae donec non |
8 | Heidi | Rush | 738 | 1425 Porta Rd | SD | 14708 | (341) 095-7183 | DSchrag@sapien.net | nullam sed aliquam turpis et sagittis libero sed tellus dui |
9 | Ganesh | Comeau | 385 | 2641 Hendrerit Dr | MT | 66612 | (201) 977-9765 | SBurks@ipsum.ly | sit vestibulum ac pretium eget augue sit augue sagittis tellus |
10 | Regine | Marina | 479 | 6204 Ac Rd | WI | 55667 | (824) 223-9924 | VPeschke@pharetra.org | amet fringilla vitae tortor vestibulum egestas eget eget amet sed |
11 | Wichaya | Thomas | 487 | 861 Risus Dr | KY | 63224 | (599) 823-8970 | BMohamed@adipiscing.ly | placerat dolor pulvinar nec morbi amet porta sagittis lacus magna |
12 | Douglass | Holliday | 488 | 8829 Sit Ave | IA | 86970 | (113) 897-8276 | CLieb@convallis.io | dolor magna id amet lorem eros ipsum magna non aliquam |
13 | Prince | Schwartzberg | 790 | 1757 Sit Ct | IL | 94739 | (299) 471-3039 | DFavus@quis.org | magna tincidunt ipsum hendrerit ac vitae tortor consequat magna elit |
14 | Lola | Hensley | 486 | 8159 Dui Rd | MN | 88877 | (788) 031-7392 | MBradley@scelerisque.org | suspendisse donec placerat nec suspendisse lacus ipsum elementum at lorem |
15 | Dainius | Finn | 355 | 6072 Massa Dr | VT | 75787 | (638) 345-2650 | MWilcox@velit.ly | morbi pretium dui dolor elit sed non vestibulum sit dui |
16 | Aisha | Schuhmann | 328 | 9709 Sagittis Ln | ND | 44161 | (147) 281-5251 | GDech@mi.com | massa sed placerat libero egestas at massa sagittis libero orci |
17 | Maria | Peacock | 269 | 2241 Amet Ave | MO | 81339 | (656) 079-5964 | POliva@tincidunt.org | ac hendrerit molestie ipsum facilisis massa odio fringilla hendrerit neque |
18 | Otilia | Denbesten | 778 | 1965 Nunc Ct | SC | 98692 | (985) 745-0452 | SWieber@porttitor.net | aliquam orci odio id ac magna magna aenean sagittis lectus |
19 | Jian | Sanchez | 796 | 6439 Sit Ln | OR | 24879 | (168) 754-6725 | AVrtis@porttitor.net | sapien ipsum nullam pretium quis tincidunt tincidunt sit mattis porttitor |
20 | Tanny | Wieland | 814 | 7331 Et Rd | SD | 65216 | (414) 322-1606 | ACasariego@et.org | odio augue in id lacus tincidunt morbi tempor orci tincidunt |
21 | Alejandro | Sidaway | 995 | 8125 Placerat Rd | VA | 98301 | (202) 112-1194 | RHaag@nullam.ly | lacus aliquam et sagittis etiam aenean lorem ipsum non facilisis |
22 | Yolanda | Swanson | 530 | 276 Amet Ct | VT | 42999 | (621) 796-4436 | TDenard@lectus.gov | lacus vitae quis dui orci ipsum odio pulvinar et nunc |
23 | Azra | Filleul | 443 | 499 Sagittis Dr | OK | 59700 | (485) 530-0532 | LSwetland@consectetur.net | magna mattis sollicitudin placerat vel facilisis sed ac non et |
24 | Cassandra | Labrucherie | 606 | 6849 Tellus Ct | SC | 44245 | (960) 044-9381 | WLafave@lectus.io | ac nullam magna ante sapien tellus tincidunt eros magna sagittis |
25 | Theodore | Saver | 150 | 5 Tincidunt Ave | IL | 58210 | (152) 001-4978 | KTorres@sed.io | ac tincidunt nec rutrum pulvinar id aliquam placerat pharetra placerat |
26 | Susi | Murphy | 900 | 1614 Hendrerit St | AZ | 80212 | (532) 030-5050 | ZRingling@sit.io | quis odio et sapien sit amet eros et augue turpis |
27 | Corazon | Lawrence | 577 | 3571 Facilisis Rd | CA | 35195 | (318) 200-2692 | REckhart@scelerisque.io | tincidunt sit dolor mi donec magna massa vel suspendisse placerat |
28 | Khosrow | Fisher | 802 | 4323 Tortor Ln | AK | 38949 | (493) 277-9670 | FHarmati@magna.ly | lectus tortor ac ipsum sagittis lacus dolor ac fringilla nec |
29 | Melgema | Lopez | 893 | 1738 Vestibulum Ln | MS | 32638 | (953) 255-2707 | ABurgin@tortor.ly | molestie at vel at placerat pharetra consequat dolor nunc placerat |
30 | Chun | Lester | 928 | 9681 Vestibulum Ct | ND | 21333 | (474) 719-0476 | ETierney@pulvinar.gov | vestibulum ipsum tincidunt placerat eros turpis morbi ipsum sit malesuada |
31 | Dwayne | Balasubramanian | 418 | 3129 Pharetra Dr | SD | 57558 | (457) 589-4620 | ESyner@aenean.com | amet sit nec amet lectus augue consequat consectetur vel sed |
32 | Joshua | Williamson | 702 | 6313 Vestibulum St | NJ | 39057 | (346) 084-7444 | VFeldman@elit.ly | sit tempor at lacus libero lorem sit nullam tempor aliquam |
33 | Shawn | Dartmann | 124 | 4892 Aliquam Rd | IA | 17745 | (500) 390-3779 | RNesbitt@massa.net | sit sapien magna libero augue consectetur fringilla orci ac tortor |
34 | Rupa | Helgren | 594 | 5944 Sed Ave | CO | 96680 | (174) 841-4348 | FShebish@morbi.net | at elementum neque ac in consequat elementum magna vitae mattis |
35 | Gia | Marks | 635 | 2519 Convallis Dr | GA | 66324 | (188) 657-9140 | SForsyth@adipiscing.gov | pharetra pulvinar amet dui elementum suspendisse et odio tellus amet |
36 | Tyetha | Ahn | 543 | 9900 Eros Ct | PA | 53390 | (482) 686-6141 | LHobbs@non.io | pulvinar lorem quis fringilla eget velit sed augue rutrum augue |
37 | Gregory | Christine | 527 | 751 Ipsum Rd | AK | 44543 | (258) 666-2073 | HCrooker@donec.com | massa vitae dolor sollicitudin consectetur sollicitudin malesuada massa velit egestas |
38 | Yelena | Shanoski | 646 | 1612 Donec Ave | KY | 30729 | (905) 301-3407 | JMcmenamin@massa.gov | sapien rutrum adipiscing et sed sollicitudin vestibulum pharetra at neque |
39 | Thursday | Helm | 666 | 5568 Nec Rd | NE | 94390 | (487) 403-7019 | RMorin@sed.org | risus hendrerit sollicitudin vestibulum placerat lorem eros consequat lorem magna |
40 | Melinda | Oliva | 525 | 6973 Rutrum Ct | IA | 38519 | (964) 234-5172 | FStephens@in.com | dolor lacus nec odio in etiam facilisis lorem ipsum et |
41 | Latasha | Slocum | 210 | 8374 Fringilla St | NV | 23913 | (678) 453-4263 | JWelchert@id.gov | donec massa dolor elementum scelerisque risus lacus id lorem in |
42 | Kenneth | Zazzara | 269 | 3364 Tempor Dr | MO | 30642 | (874) 633-3017 | TGarayan@tincidunt.ly | sollicitudin nullam egestas aenean molestie velit nec sed tincidunt scelerisque |
43 | Francine | Daniels | 366 | 2141 Amet Rd | OH | 90786 | (856) 781-7309 | SIngham@pretium.ly | egestas amet vel ac pretium lacus nec tortor facilisis et |
44 | Marie | Krebs | 124 | 4229 Sit Ln | DE | 41786 | (572) 023-1295 | EClagg@curabitur.io | lacus elit sagittis quis nec vestibulum malesuada mattis morbi etiam |
45 | Stanley | Zehnacker | 456 | 4610 Odio St | VT | 70223 | (257) 234-6755 | HPennell@morbi.gov | vel aliquam mattis libero sed pharetra donec malesuada pharetra lectus |
46 | Furdella | Toffoli | 951 | 8366 Placerat Rd | AZ | 20381 | (740) 422-8726 | YEarls@morbi.net | non aliquam neque tortor egestas pulvinar tempor amet molestie lorem |
47 | Talatha | Nye | 808 | 6884 Dolor Dr | MS | 97282 | (589) 157-7730 | DAcosta@rutrum.gov | ipsum turpis vestibulum at convallis sit neque elementum sed adipiscing |
48 | Brent | Vollrath | 479 | 5362 Eget Dr | MO | 74989 | (664) 642-4525 | YMarina@sollicitudin.net | massa elementum elit pretium malesuada mi vestibulum non aliquam neque |
49 | Melissa | Quintana | 405 | 1302 Lacus Dr | PA | 38853 | (354) 903-9363 | AMarrinson@lacus.io | morbi quis neque placerat malesuada tincidunt morbi risus at tortor |
50 | Guadalupe | Eseltine | 206 | 5495 Rutrum Ct | AR | 37546 | (540) 500-5816 | TLester@morbi.com | porttitor sit massa ipsum ac massa ac hendrerit vitae malesuada |