Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

sticky header widget

  • Loading branch information...
commit e42c42131a5a79cbea9c4820b063386e9e563b75 1 parent 1f8a9ce
Rob G authored
50 README.markdown
View
@@ -28,6 +28,15 @@ Included all original [document pages](http://mottie.github.com/tablesorter/docs
View the [complete listing here](http://mottie.github.com/tablesorter/changelog.txt).
+#### Version 2.0.21.1 (2011-10-11)
+
+* Added "stickyHeader" widget to the "jquery.tablesorter.widgets.js" file.
+ * This widget makes the header stick to the top of the page while scrolling down.
+ * The sticky header is fully functional and will allow you to sort the table.
+ * And best of all, it can be applied to the original tablesorter plugin.
+ * Thanks to Chris Coyier and his post on [persistent headers](http://css-tricks.com/13465-persistent-headers/).
+* Added a compressed widget file named "jquery.tablesorter.widgets.min.js".
+
#### Version 2.0.21 (2011-09-22)
* Added `sortBegin` event
@@ -123,44 +132,3 @@ View the [complete listing here](http://mottie.github.com/tablesorter/changelog.
* Updated the [Dealing with markup inside cells](http://mottie.github.com/tablesorter/docs/example-option-text-extraction.html) demo.
* Thanks to Eugene Ivakhiv for bringing this issue to my attention in my blog.
-
-#### Version 2.0.11 (2011-08-04)
-
-* Added the ability to set a column parser using a class name
- * When setting the parser, start the class name with "sorter-" followed by the parser name, e.g. "sorter-text" or "sorter-digit"
- * The column can be disabled by setting the class name to "sorter-false"
- * [Demo page](http://mottie.github.com/tablesorter/docs/example-parsers-class-name.html) included.
- * Custom parsers can also be used - see the updated [writing custom parsers demo](http://mottie.github.com/tablesorter/docs/example-parsers.html).
-
-#### Version 2.0.10 (2011-07-31)
-
-* Modified the numeric sort with a new method to deal with non-numeric content:
- * When sorting columns with numeric values, by default any non-numeric or empty cells are treated as if they have a zero value. This puts the text between negative and positive values in a column.
- * Adding `string : "max+"` to the `headers` option will now treat any non-numeric table cells as if they have a maxiumum positive value (a value greater than the maximum positive value in the column).
- * Adding `string : "max-"` to the `headers` option will now treat any non-numeric table cells as if they have a maxiumum negative value (a value greater than the maximum negative value in the column).
- * See the "[Dealing with text strings in numeric sorts](http://mottie.github.com/tablesorter/docs/example-options-headers-digits-strings.html)" demo for a better visual example.
-* Changed UI theme widget code to use "ui-widget-header" instead of "ui-widget-default" to better match the themes.
-* Renamed changelog.markdown to changelog.txt to prevent downloading when clicking on the link
-
-#### Version 2.0.9 (2011-07-27)
-
-* Added a jQuery UI theme and widget example. To apply the jQuery UI theme:
- * Include any jQuery UI theme on your page.
- * Add the base tablesorter ui theme (located in css/ui directory)
- * Add the jQuery UI theme widget code found on [this example page](http://mottie.github.com/tablesorter/docs/example-ui-theme.html). This demo page includes the UI theme switcher.
-* Added a header index to the `onRenderHeader` function to make it easier to target specific header cells for modification. See the [render header example](http://mottie.github.com/tablesorter/docs/example-option-render-header.html) for an example.
-* Pager plugin updates:
- * Removed the `separator` option and added an `output` option which allows you to completely customize the output string.
- * In the `output` string, include any of the following variables:
- * `{page}` is replaced with the current page number.
- * `{totalPages}` is replaced with the total number of pages.
- * `{startRow}` is replaced with the number of the visible start row of the pager.
- * `{endRow}` is replaced with the number of the visible end row of the pager.
- * `{totalRows}` is replaced with the total number of rows.
- * The `cssPageDisplay` option can now target any element; in previous versions, this element was an input of type text.
- * Added a `pagerArrows` and `cssDisabled` options:
- * When `pagerArrows` is true, the first and previous pager arrows have the css class name contained in the `cssDisabled` option applied when the first row is visible.
- * The next and last pager arrows will be have the `cssDisabled` class applied when the last row is visible.
- * Additionally, if the number of table rows is less than the pager size, the pager will get the `cssDisabled` class name applied.
- * If false (the default setting), the pager arrows class names will not change.
- * Please see the updated [pager demo](http://mottie.github.com/tablesorter/docs/example-pager.html) to see this working.
10 changelog.txt
View
@@ -1,5 +1,15 @@
TableSorter Change Log
+Version 2.0.21.1 (2011-10-11)
+============================
+
+* Added "stickyHeader" widget to the "jquery.tablesorter.widgets.js" file.
+ * This widget makes the header stick to the top of the page while scrolling down.
+ * The sticky header is fully functional and will allow you to sort the table.
+ * And best of all, it can be applied to the original tablesorter plugin.
+ * Thanks to Chris Coyier and his post on [persistent headers](http://css-tricks.com/13465-persistent-headers/).
+* Added a compressed widget file named "jquery.tablesorter.widgets.min.js".
+
Version 2.0.21 (2011-09-22)
============================
4 docs/css/jq.css
View
@@ -43,4 +43,6 @@ table#options *,table#methods *,table#events *{font-size:small;}
p.tip em {padding: 2px; background-color: #6cf; color: #FFF;}
span.tip em {padding: 0 2px;background-color: #00ce53; color: #fff; font-size:90%; }
div.digg {float: right;}
-.next-up { padding-top: 10px; font-size: 90%; }
+.next-up { padding-top: 10px; font-size: 90%; }
+.narrow-block { width: 50%; margin: 0 auto; }
+.spacer { height: 800px; }
3  docs/example-widget-filter.html
View
@@ -48,6 +48,7 @@
<li>Added filter header option and class name to allow disabling the filter in a specific column in v2.0.19.1.</li>
<li>The Discount column has the "filter-false" class added to the header - see the HTML on how to add this ability.</li>
<li>The Date column has the "headers" option applied to disable the sort and the filter - see the table options in the javascript for this example.</li>
+ </ul>
</p>
<h1>Demo</h1>
@@ -165,7 +166,7 @@
<div class="next-up">
<hr />
- Next up: <a href="example-widget-ui-theme.html">Basic: Applying a jQuery UI theme widget &rsaquo;&rsaquo;</a>
+ Next up: <a href="example-widget-sticky-header.html">Basic: Applying the sticky header widget &rsaquo;&rsaquo;</a>
</div>
</div>
151 docs/example-widget-sticky-header.html
View
@@ -0,0 +1,151 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>jQuery plugin: Tablesorter 2.0 - Sticky Header Widget</title>
+
+ <!-- jQuery -->
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
+
+ <!-- Demo stuff -->
+ <link rel="stylesheet" href="css/jq.css">
+ <script src="js/chili/jquery.chili-2.2.js"></script>
+ <script src="js/chili/recipes.js"></script>
+ <script src="js/docs.js"></script>
+
+ <!-- Tablesorter: required -->
+ <link rel="stylesheet" href="../css/blue/style.css">
+ <script src="../js/jquery.tablesorter.js"></script>
+ <script src="../js/jquery.tablesorter.widgets.js"></script>
+
+<script id="js">$(function(){
+
+ $("table").tablesorter({
+ widgets: ['stickyHeaders']
+ });
+
+}); </script>
+</head>
+<body>
+
+<div id="banner">
+ <h1>table<em>sorter</em></h1>
+ <h2>Sticky Header Widget</h2>
+ <h3>Flexible client-side table sorting</h3>
+ <a href="index.html">Back to documentation</a>
+</div>
+
+<div id="main">
+
+ <p class="tip">
+ <em>NOTE!</em>
+ <ul>
+ <li>This widget can be applied to the original plugin. The code is in the "jquery.tablesorter.widgets.js" file.</li>
+ <li>Scroll down the page to see the headers stick! Then try sorting the columns.</li>
+ </ul>
+ </p>
+
+ <h1>Javascript</h1>
+ <div id="javascript">
+ <pre class="js"></pre>
+ </div>
+
+ <h1>Demo</h1>
+ <table class="tablesorter">
+ <thead>
+ <tr><th>Name</th><th>Major</th><th>Sex</th><th>English</th><th>Japanese</th><th>Calculus</th><th>Geometry</th></tr>
+ </thead>
+ <tfoot>
+ <tr><th>Name</th><th>Major</th><th>Sex</th><th>English</th><th>Japanese</th><th>Calculus</th><th>Geometry</th></tr>
+ </tfoot>
+ <tbody>
+ <tr><td>Student01</td><td>Languages</td><td>male</td><td>80</td><td>70</td><td>75</td><td>80</td></tr>
+ <tr><td>Student02</td><td>Mathematics</td><td>male</td><td>90</td><td>88</td><td>100</td><td>90</td></tr>
+ <tr><td>Student03</td><td>Languages</td><td>female</td><td>85</td><td>95</td><td>80</td><td>85</td></tr>
+ <tr><td>Student04</td><td>Languages</td><td>male</td><td>60</td><td>55</td><td>100</td><td>100</td></tr>
+ <tr><td>Student05</td><td>Languages</td><td>female</td><td>68</td><td>80</td><td>95</td><td>80</td></tr>
+ <tr><td>Student06</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
+ <tr><td>Student07</td><td>Mathematics</td><td>male</td><td>85</td><td>68</td><td>90</td><td>90</td></tr>
+ <tr><td>Student08</td><td>Languages</td><td>male</td><td>100</td><td>90</td><td>90</td><td>85</td></tr>
+ <tr><td>Student09</td><td>Mathematics</td><td>male</td><td>80</td><td>50</td><td>65</td><td>75</td></tr>
+ <tr><td>Student10</td><td>Languages</td><td>male</td><td>85</td><td>100</td><td>100</td><td>90</td></tr>
+ <tr><td>Student11</td><td>Languages</td><td>male</td><td>86</td><td>85</td><td>100</td><td>100</td></tr>
+ <tr><td>Student12</td><td>Mathematics</td><td>female</td><td>100</td><td>75</td><td>70</td><td>85</td></tr>
+ <tr><td>Student13</td><td>Languages</td><td>female</td><td>100</td><td>80</td><td>100</td><td>90</td></tr>
+ <tr><td>Student14</td><td>Languages</td><td>female</td><td>50</td><td>45</td><td>55</td><td>90</td></tr>
+ <tr><td>Student15</td><td>Languages</td><td>male</td><td>95</td><td>35</td><td>100</td><td>90</td></tr>
+ <tr><td>Student16</td><td>Languages</td><td>female</td><td>100</td><td>50</td><td>30</td><td>70</td></tr>
+ <tr><td>Student17</td><td>Languages</td><td>female</td><td>80</td><td>100</td><td>55</td><td>65</td></tr>
+ <tr><td>Student18</td><td>Mathematics</td><td>male</td><td>30</td><td>49</td><td>55</td><td>75</td></tr>
+ <tr><td>Student19</td><td>Languages</td><td>male</td><td>68</td><td>90</td><td>88</td><td>70</td></tr>
+ <tr><td>Student20</td><td>Mathematics</td><td>male</td><td>40</td><td>45</td><td>40</td><td>80</td></tr>
+ <tr><td>Student21</td><td>Languages</td><td>male</td><td>50</td><td>45</td><td>100</td><td>100</td></tr>
+ <tr><td>Student22</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
+ <tr><td>Student23</td><td>Languages</td><td>female</td><td>85</td><td>80</td><td>80</td><td>80</td></tr>
+ <tr><td>student23</td><td>Mathematics</td><td>male</td><td>82</td><td>77</td><td>0</td><td>79</td></tr>
+ <tr><td>student24</td><td>Languages</td><td>female</td><td>100</td><td>91</td><td>13</td><td>82</td></tr>
+ <tr><td>student25</td><td>Mathematics</td><td>male</td><td>22</td><td>96</td><td>82</td><td>53</td></tr>
+ <tr><td>student26</td><td>Languages</td><td>female</td><td>37</td><td>29</td><td>56</td><td>59</td></tr>
+ <tr><td>student27</td><td>Mathematics</td><td>male</td><td>86</td><td>82</td><td>69</td><td>23</td></tr>
+ <tr><td>student28</td><td>Languages</td><td>female</td><td>44</td><td>25</td><td>43</td><td>1</td></tr>
+ <tr><td>student29</td><td>Mathematics</td><td>male</td><td>77</td><td>47</td><td>22</td><td>38</td></tr>
+ <tr><td>student30</td><td>Languages</td><td>female</td><td>19</td><td>35</td><td>23</td><td>10</td></tr>
+ <tr><td>student31</td><td>Mathematics</td><td>male</td><td>90</td><td>27</td><td>17</td><td>50</td></tr>
+ <tr><td>student32</td><td>Languages</td><td>female</td><td>60</td><td>75</td><td>33</td><td>38</td></tr>
+ <tr><td>student33</td><td>Mathematics</td><td>male</td><td>4</td><td>31</td><td>37</td><td>15</td></tr>
+ <tr><td>student34</td><td>Languages</td><td>female</td><td>77</td><td>97</td><td>81</td><td>44</td></tr>
+ <tr><td>student35</td><td>Mathematics</td><td>male</td><td>5</td><td>81</td><td>51</td><td>95</td></tr>
+ <tr><td>student36</td><td>Languages</td><td>female</td><td>70</td><td>61</td><td>70</td><td>94</td></tr>
+ <tr><td>student37</td><td>Mathematics</td><td>male</td><td>60</td><td>3</td><td>61</td><td>84</td></tr>
+ <tr><td>student38</td><td>Languages</td><td>female</td><td>63</td><td>39</td><td>0</td><td>11</td></tr>
+ <tr><td>student39</td><td>Mathematics</td><td>male</td><td>50</td><td>46</td><td>32</td><td>38</td></tr>
+ <tr><td>student40</td><td>Languages</td><td>female</td><td>51</td><td>75</td><td>25</td><td>3</td></tr>
+ <tr><td>student41</td><td>Mathematics</td><td>male</td><td>43</td><td>34</td><td>28</td><td>78</td></tr>
+ <tr><td>student42</td><td>Languages</td><td>female</td><td>11</td><td>89</td><td>60</td><td>95</td></tr>
+ <tr><td>student43</td><td>Mathematics</td><td>male</td><td>48</td><td>92</td><td>18</td><td>88</td></tr>
+ <tr><td>student44</td><td>Languages</td><td>female</td><td>82</td><td>2</td><td>59</td><td>73</td></tr>
+ <tr><td>student45</td><td>Mathematics</td><td>male</td><td>91</td><td>73</td><td>37</td><td>39</td></tr>
+ <tr><td>student46</td><td>Languages</td><td>female</td><td>4</td><td>8</td><td>12</td><td>10</td></tr>
+ <tr><td>student47</td><td>Mathematics</td><td>male</td><td>89</td><td>10</td><td>6</td><td>11</td></tr>
+ <tr><td>student48</td><td>Languages</td><td>female</td><td>90</td><td>32</td><td>21</td><td>18</td></tr>
+ <tr><td>student49</td><td>Mathematics</td><td>male</td><td>42</td><td>49</td><td>49</td><td>72</td></tr>
+ <tr><td>student50</td><td>Languages</td><td>female</td><td>56</td><td>37</td><td>67</td><td>54</td></tr>
+ </tbody>
+ </table>
+
+ <div class="narrow-block">
+ <table class="tablesorter">
+ <thead>
+ <tr><th>Account #</th><th>First Name</th><th>Last Name</th><th>Age</th><th>Total</th><th>Discount</th><th>Diff</th></tr>
+ </thead>
+ <tbody>
+ <tr><td>A43</td><td>Peter</td><td>Parker</td><td>28</td><td>9.99</td><td>20.3%</td><td>+3</td></tr>
+ <tr><td>A255</td><td>John</td><td>Hood</td><td>33</td><td>19.99</td><td>25.1%</td><td>-7</td></tr>
+ <tr><td>A33</td><td>Clark</td><td>Kent</td><td>18</td><td>15.49</td><td>44.2%</td><td>-13</td></tr>
+ <tr><td>A11</td><td>Bruce</td><td>Almighty</td><td>45</td><td>153.19</td><td>44%</td><td>+19</td></tr>
+ <tr><td>A102</td><td>Bruce</td><td>Evans</td><td>56</td><td>153.19</td><td>23%</td><td>+9</td></tr>
+ <tr><td>A23</td><td>Mike</td><td>Peters</td><td>22</td><td>5.69</td><td>20.3%</td><td>+2</td></tr>
+ <tr><td>A55</td><td>Leslie</td><td>Kent</td><td>33</td><td>15.99</td><td>25.1%</td><td>-3</td></tr>
+ <tr><td>A3</td><td>Frank</td><td>Mint</td><td>44</td><td>12.59</td><td>44.2%</td><td>-12</td></tr>
+ <tr><td>A21</td><td>Joe</td><td>Thomas</td><td>45</td><td>15.25</td><td>44%</td><td>+12</td></tr>
+ <tr><td>A12</td><td>Tess</td><td>Evans</td><td>66</td><td>13.59</td><td>23%</td><td>+4</td></tr>
+ <tr><td>A21</td><td>Peter</td><td>Dunn</td><td>12</td><td>2.99</td><td>21.1%</td><td>+2</td></tr>
+ <tr><td>A33</td><td>Harry</td><td>Jones</td><td>13</td><td>19.49</td><td>22.2%</td><td>-6</td></tr>
+ <tr><td>A13</td><td>John</td><td>James</td><td>16</td><td>13.89</td><td>42.1%</td><td>-13</td></tr>
+ <tr><td>A71</td><td>Nick</td><td>Parker</td><td>45</td><td>13.89</td><td>44%</td><td>+29</td></tr>
+ <tr><td>A21</td><td>Charles</td><td>Dunn</td><td>19</td><td>15.49</td><td>22%</td><td>+3</td></tr>
+ </tbody>
+ </table>
+ </div>
+
+ <div class="spacer"></div>
+ <div class="next-up">
+ <hr />
+ Next up: <a href="example-widget-ui-theme.html">Basic: Applying a jQuery UI theme widget &rsaquo;&rsaquo;</a>
+ </div>
+
+</div>
+
+</body>
+</html>
+
1  docs/index.html
View
@@ -301,6 +301,7 @@
<li><a href="example-widget-zebra.html">Applying the zebra stripe widget</a></li>
<li><a href="example-widget-columns.html">Applying the columns widget</a> <span class="tip"><em>New! v2.0.17</em></span></li>
<li><a href="example-widget-filter.html">Applying the filter widget</a> <span class="tip"><em>New! v2.0.18</em></span></li>
+ <li><a href="example-widget-sticky-header.html">Applying the sticky header widget</a> <span class="tip"><em>New! v2.0.21.1</em></span></li>
<li><a href="example-widget-ui-theme.html">Applying the jQuery UI theme widget</a> <span class="tip"><em>New! v2.0.9</em></span></li>
<li><a href="example-parsers-class-name.html">Disable or set the column parser using class names</a> <span class="tip"><em>New! v2.0.11</em></span></li>
<li><a href="example-options-headers.html">Disable sort using headers options</a></li>
57 js/jquery.tablesorter.widgets.js
View
@@ -131,4 +131,61 @@ $.tablesorter.addWidget({
}
});
+// Sticky header widget
+// based on this awesome article:
+// http://css-tricks.com/13465-persistent-headers/
+// **************************
+$.tablesorter.addWidget({
+ id: "stickyHeaders",
+ format: function(table) {
+ if ($(table).find('.stickyHeader').length) { return; }
+ var win = $(window),
+ header = $(table).find('thead'),
+ hdrCells = header.find('tr').children(),
+ sticky = header.find('tr').clone()
+ .addClass('stickyHeader')
+ .css({
+ width : header.width(),
+ position : 'fixed',
+ top : 0,
+ visibility : 'hidden'
+ }),
+ stkyCells = sticky.children();
+ // update sticky header class names to match real header
+ $(table).bind('sortEnd', function(e,t){
+ var th = $(t).find('thead tr'),
+ sh = th.filter('.stickyHeader').children();
+ th.filter(':not(.stickyHeader)').children().each(function(i){
+ sh.eq(i).attr('class', $(this).attr('class'));
+ });
+ });
+ // set sticky header cell width and link clicks to real header
+ hdrCells.each(function(i){
+ var t = $(this),
+ s = stkyCells.eq(i)
+ // set cell widths
+ .width( t.width() )
+ // clicking on sticky will trigger sort
+ .bind('click', function(e){
+ t.trigger(e);
+ })
+ // prevent sticky header text selection
+ .bind('mousedown', function(){
+ this.onselectstart = function(){ return false; };
+ return false;
+ });
+ });
+ header.prepend( sticky );
+ // make it sticky!
+ win.scroll(function(){
+ var $t = $(table),
+ offset = $t.offset(),
+ sTop = win.scrollTop(),
+ sticky = $t.find('.stickyHeader'),
+ vis = ((sTop > offset.top) && (sTop < offset.top + $t.height())) ? 'visible' : 'hidden';
+ sticky.css('visibility', vis);
+ });
+ }
+});
+
})(jQuery);
7 js/jquery.tablesorter.widgets.min.js
View
@@ -0,0 +1,7 @@
+/* TableSorter 2.0 Widgets */
+(function(b){
+b.tablesorter.addWidget({id:"uitheme",format:function(e){var c,f,g,d=e.config,a=["ui-icon-arrowthick-2-n-s","ui-icon-arrowthick-1-s","ui-icon-arrowthick-1-n"];d.widgetUitheme&&d.widgetUitheme.hasOwnProperty("css")&&(a=d.widgetUitheme.css||a);g=a.join(" ");d.debug&&(c=new Date);b(e).is(".ui-theme")||(b(e).addClass("ui-widget ui-widget-content ui-corner-all ui-theme"),b.each(d.headerList,function(){b(this).addClass("ui-widget-header ui-corner-all").append('<span class="ui-icon"/>').hover(function(){b(this).addClass("ui-state-hover")}, function(){b(this).removeClass("ui-state-hover")})}));b.each(d.headerList,function(c){d.headers[c]&&d.headers[c].sorter===false?b(this).find("span.ui-icon").removeClass(g+" ui-icon"):(f=b(this).is("."+d.cssAsc)?a[1]:b(this).is("."+d.cssDesc)?a[2]:b(this).is("."+d.cssHeader)?a[0]:"",b(this)[f===a[0]?"removeClass":"addClass"]("ui-state-active").find("span.ui-icon").removeClass(g).addClass(f))});d.debug&&b.tablesorter.benchmark("Applying uitheme widget",c)}});
+b.tablesorter.addWidget({id:"columns",format:function(e){var c, f,g,d,a=e.config,i=a.sortList,j=i.length,h=["primary","secondary","tertiary"];a.widgetColumns&&a.widgetColumns.hasOwnProperty("css")&&(h=a.widgetColumns.css||h);g=h.length-1;d=h.join(" ");a.debug&&(f=new Date);i&&i[0]&&b("tr:visible",e.tBodies[0]).each(function(a){c=b(this).children().removeClass(d);c.eq(i[0][0]).addClass(h[0]);if(j>1)for(a=1;a<j;a++)c.eq(i[a][0]).addClass(h[a]||h[g])});a.debug&&b.tablesorter.benchmark("Applying Columns widget",f)}});
+b.tablesorter.addWidget({id:"filter",format:function(e){if(!e.config.filtering){var c, f,g,d,a=e.config,i=a.headerList.length,j=b(e),e='<tr class="filters">',h;a.debug&&(h=new Date);for(c=0;c<i;c++)e+='<td><input type="text" class="filter" data-col="'+c+'" style="',e+=a.headers[c]&&"filter"in a.headers[c]&&a.headers[c].filter===false||b(a.headerList[c]).is(".filter-false")?"visibility:hidden":"",e+='"></td>';j.find("thead").append(e+="</tr>").find(".filter").bind("keyup",function(){f=j.find(".filter").map(function(){return(b(this).val()||"").toLowerCase()}).get();f.join("")===""?j.find("tr").show(): j.find("tbody").find("tr").each(function(){g=true;d=b(this).find("td");for(c=0;c<i;c++)f[c]!==""&&d.eq(c).text().toLowerCase().indexOf(f[c])>=0?g=g?true:false:f[c]!==""&&(g=false);b(this)[g?"show":"hide"]()});j.trigger("applyWidgets")});a.filtering=true;a.debug&&b.tablesorter.benchmark("Applying Filter widget",h)}}});
+b.tablesorter.addWidget({id:"stickyHeaders",format:function(e){if(!b(e).find(".stickyHeader").length){var c=b(window),f=b(e).find("thead"),g=f.find("tr").children(),d=f.find("tr").clone().addClass("stickyHeader").css({width:f.width(), position:"fixed",top:0,visibility:"hidden"}),a=d.children();b(e).bind("sortEnd",function(a,c){var d=b(c).find("thead tr"),e=d.filter(".stickyHeader").children();d.filter(":not(.stickyHeader)").children().each(function(a){e.eq(a).attr("class",b(this).attr("class"))})});g.each(function(c){var d=b(this);a.eq(c).width(d.width()).bind("click",function(b){d.trigger(b)}).bind("mousedown",function(){this.onselectstart=function(){return false};return false})});f.prepend(d);c.scroll(function(){var a=b(e),d= a.offset(),f=c.scrollTop(),g=a.find(".stickyHeader"),a=f>d.top&&f<d.top+a.height()?"visible":"hidden";g.css("visibility",a)})}}})
+})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.