Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

pager ajax works with stickyheaders now

  • Loading branch information...
commit 04aacd54493b7a4652f4d5d1f160d52ecbf63484 1 parent 16330a2
Rob G authored
1  README.markdown
View
@@ -42,6 +42,7 @@ View the [complete listing here](http://mottie.github.com/tablesorter/changelog.
* The `sortInitialOrder` will work in either the main options or specifically within the headers option when a particular column needs a different initial sort order.
* Added a [sortReset/sortRestart](http://mottie.github.com/tablesorter/docs/example-option-sortreset-sortrestart.html) demo.
* Resolves [issue #30](https://github.com/Mottie/tablesorter/issues/29).
+* Updated pager plugin to better work with the sticky header widget.
#### Version 2.1 (3/7/2012)
11 addons/pager/jquery.tablesorter.pager.css
View
@@ -24,4 +24,15 @@ div.tablesorterPager input {
background: rgba(255,255,255,0.8) url(icons/loading.gif) center center no-repeat;
position: absolute;
z-index: 1000;
+}
+/*** css used when "updateArrows" option is true ***/
+/* the pager itself gets a disabled class when the number of rows is less than the size */
+.pager.disabled {
+ display: none;
+}
+/* hide or fade out pager arrows when the first or last row is visible */
+.pager img.disabled {
+ /* visibility: hidden */
+ opacity: 0.5;
+ filter: alpha(opacity=50);
}
16 addons/pager/jquery.tablesorter.pager.js
View
@@ -1,6 +1,6 @@
/*
* tablesorter pager plugin
- * updated 3/7/2012
+ * updated 3/8/2012
*/
(function($) {
@@ -149,7 +149,9 @@
// process data
if (typeof(c.ajaxProcessing) === "function") {
var result = c.ajaxProcessing(data), d = result[0], l = d.length,
- i, k, th = [], tds = '', tf = '';
+ i, k, th = [], tds = '', tf = '', hsh = $(table).addClass('hasStickyHeaders'),
+ sh = '.' + ((table.config.widgetOptions && table.config.widgetOptions.stickyHeaders) || 'tablesorter-stickyheader'),
+ $sh = $t.find(sh);
for ( i=0; i < l; i++ ) {
tds += '<tr>';
for (k in d[i]) {
@@ -162,11 +164,17 @@
}
tds += '</tr>';
}
- $t.find('thead th').each(function(j){
+ $t.find('thead tr.tablesorter-header th').each(function(j){
var $t = $(this),
// add new test within the first span it finds, or just in the header
tar = ($t.find('span').length) ? $t.find('span:first') : $t;
- $t.html(th[j]);
+ tar.html(th[j]);
+ // update sticky headers
+ if (hsh && $sh.length){
+ tar = $sh.find('th').eq(j);
+ tar = (tar.find('span').length) ? tar.find('span:first') : tar;
+ tar.html(th[j]);
+ }
tf += '<th>' + th[j] + '</th>';
});
$t.find('tfoot').html('<tr>' + tf + '</tr>');
4 addons/pager/jquery.tablesorter.pager.min.js
View
@@ -1,3 +1,3 @@
-/* tablesorter pager plugin minified - updated 3/7/2012 */
+/* tablesorter pager plugin minified - updated 3/8/2012 */
-(function(d){d.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,ajaxProcessing:function(){return[[{key:"value"}],100]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,size:10,fixedHeight:!1,removeRows:!0,cssNext:".next",cssPrev:".prev",cssFirst:".first",cssLast:".last",cssPageDisplay:".pagedisplay",cssPageSize:".pagesize",cssDisabled:"disabled",totalRows:0,totalPages:0};var h=this,i=function(c,a){var b=c.cssDisabled,e=!!a;c.updateArrows&& (c.container[c.totalRows<c.size?"addClass":"removeClass"](b),d(c.cssFirst+","+c.cssPrev,c.container)[e||0===c.page?"addClass":"removeClass"](b),d(c.cssNext+","+c.cssLast,c.container)[e||c.page===c.totalPages-1?"addClass":"removeClass"](b))},s=function(c,a){a.startRow=a.size*a.page+1;a.endRow=Math.min(a.totalRows,a.size*(a.page+1));var b=d(a.cssPageDisplay,a.container),e=a.output.replace(/\{(page|totalPages|startRow|endRow|totalRows)\}/gi,function(b){return{"{page}":a.page+1,"{totalPages}":a.totalPages, "{startRow}":a.startRow,"{endRow}":a.endRow,"{totalRows}":a.totalRows}[b]});if(b[0])b["INPUT"===b[0].tagName?"val":"html"](e);i(a);d(c).trigger("pagerComplete",a)},n=function(c,a){var b,e=d(c.tBodies[0]);if(a.fixedHeight&&(e.find("tr.pagerSavedHeightSpacer").remove(),b=d.data(c,"pagerSavedHeight")))b-=e.height(),5<b&&d.data(c,"pagerLastSize")===a.size&&e.find("tr:visible").length<a.size&&e.append('<tr class="pagerSavedHeightSpacer remove-me" style="height:'+b+'px;"></tr>')},p=function(c,a){var b, e=d("tr:not(."+c.config.cssChildRow+")",c.tBodies[0]),g=e.length,f=a.page*a.size,m=f+a.size;m>g&&(m=g);for(b=0;b<g;b++)e[b].style.display=b>=f&&b<m?"":"none"},t=function(c,a){a.size=parseInt(d(a.cssPageSize,a.container).val(),10);d.data(c,"pagerLastSize",a.size);i(a);a.removeRows||(p(c,a),d(c).bind("sortEnd.pager",function(){p(c,a);d(c).trigger("applyWidgets")}))},u=function(c,a){var b,e=d(c),g=d(c.tBodies[0]),f=a.ajaxUrl.replace(/\{page\}/g,a.page).replace(/\{size\}/g,a.size);""!==f&&(b=d("<div/>", {id:"tablesorterPagerLoading",width:e.outerWidth(!0),height:e.outerHeight(!0)}),e.before(b),d.getJSON(f,function(f){if("function"===typeof a.ajaxProcessing){var f=a.ajaxProcessing(f),q=f[0],j=q.length,l,o,h=[],k="",i="";for(l=0;l<j;l++){k+="<tr>";for(o in q[l])"string"===typeof o&&(0===l&&h.push(o),k+="<td>"+q[l][o]+"</td>");k+="</tr>"}e.find("thead th").each(function(a){var b=d(this);b.find("span").length&&b.find("span:first");b.html(h[a]);i+="<th>"+h[a]+"</th>"});e.find("tfoot").html("<tr>"+i+"</tr>"); g.html(k);b.remove();e.trigger("update");a.totalRows=f[1];a.totalPages=Math.ceil(a.totalRows/a.size);s(c,a);n(c,a);e.trigger("pagerChange",a)}}))},r=function(c,a,b){var e,g,f,m=d(c.tBodies[0]),h=a.length;e=b.page*b.size;var i=e+b.size;if(!(1>h)){d(c).trigger("pagerChange",b);if(b.removeRows){i>a.length&&(i=a.length);for(d(c.tBodies[0]).empty();e<i;e++){f=a[e];h=f.length;for(g=0;g<h;g++)m[0].appendChild(f[g])}}else p(c,b);d(c).trigger("applyWidgets");b.page>=b.totalPages&&(b.page=b.totalPages-1,j(c, b));s(c,b);b.isDisabled||n(c,b)}},v=function(c,a){a.ajax?i(a,!0):(a.isDisabled=!0,d.data(c,"pagerLastPage",a.page),d.data(c,"pagerLastSize",a.size),a.page=0,a.size=a.totalRows,a.totalPages=1,d("tr.pagerSavedHeightSpacer",c.tBodies[0]).remove(),r(c,c.config.rowsCopy,a));d(a.cssPageSize,a.container).addClass(a.cssDisabled)[0].disabled=!0},j=function(c,a){if(!a.isDisabled){if(0>a.page||a.page>a.totalPages-1)a.page=0;d.data(c,"pagerLastPage",a.page);a.ajax?u(c,a):r(c,c.config.rowsCopy,a)}},w=function(c, a,b){b.size=a;d.data(c,"pagerLastPage",b.page);d.data(c,"pagerLastSize",b.size);b.totalPages=Math.ceil(b.totalRows/b.size);j(c,b)},x=function(c,a,b){var e=d(a.cssPageSize,a.container).removeClass(a.cssDisabled).removeAttr("disabled");a.isDisabled=!1;a.page=d.data(c,"pagerLastPage")||0;a.size=d.data(c,"pagerLastSize")||parseInt(e.val(),10);a.totalPages=Math.ceil(a.totalRows/a.size);b&&(d("table").trigger("update"),w(c,a.size,a),t(c,a),n(c,a))};h.appender=function(c,a){var b=c.config.pager;b.ajax|| (c.config.rowsCopy=a,b.totalRows=a.length,b.size=d.data(c,"pagerLastSize")||b.size,b.totalPages=Math.ceil(b.totalRows/b.size),r(c,a,b))};h.construct=function(c){return this.each(function(){var a=this.config,b=a.pager=d.extend({},d.tablesorterPager.defaults,c),e=this,g=d(e),f=d(b.container).show();a.appender=h.appender;x(e,b,!1);"string"===typeof b.ajaxUrl?(b.ajax=!0,u(e,b)):(b.ajax=!1,d(this).trigger("appendCache"),t(e,b));d(b.cssFirst,f).unbind("click.pager").bind("click.pager",function(){if(!d(this).hasClass(b.cssDisabled)){b.page= 0;j(e,b)}return false});d(b.cssNext,f).unbind("click.pager").bind("click.pager",function(){if(!d(this).hasClass(b.cssDisabled)){b.page++;if(b.page>=b.totalPages-1)b.page=b.totalPages-1;j(e,b)}return false});d(b.cssPrev,f).unbind("click.pager").bind("click.pager",function(){if(!d(this).hasClass(b.cssDisabled)){b.page--;if(b.page<=0)b.page=0;j(e,b)}return false});d(b.cssLast,f).unbind("click.pager").bind("click.pager",function(){if(!d(this).hasClass(b.cssDisabled)){b.page=b.totalPages-1;j(e,b)}return false}); d(b.cssPageSize,f).unbind("change.pager").bind("change.pager",function(){d(b.cssPageSize,f).val(d(this).val());if(!d(this).hasClass(b.cssDisabled)){w(e,parseInt(d(this).val(),10),b);var a=d(e.tBodies[0]);a.find("tr.pagerSavedHeightSpacer").remove();d.data(e,"pagerSavedHeight",a.height());n(e,b);d.data(e,"pagerLastSize",b.size)}return false});g.unbind("disable.pager enable.pager destroy.pager").bind("disable.pager",function(){v(e,b)}).bind("enable.pager",function(){x(e,b,true)}).bind("destroy.pager", function(){v(e,b);b.container.hide();e.config.appender=null;d(e).unbind("destroy.pager sortEnd.pager enable.pager disable.pager")})})}}});d.fn.extend({tablesorterPager:d.tablesorterPager.construct})})(jQuery);
+(function(d){d.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,ajaxProcessing:function(){return[[{key:"value"}],100]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,size:10,fixedHeight:!1,removeRows:!0,cssNext:".next",cssPrev:".prev",cssFirst:".first",cssLast:".last",cssPageDisplay:".pagedisplay",cssPageSize:".pagesize",cssDisabled:"disabled",totalRows:0,totalPages:0};var h=this,i=function(c,b){var a=c.cssDisabled,e=!!b;c.updateArrows&& (c.container[c.totalRows<c.size?"addClass":"removeClass"](a),d(c.cssFirst+","+c.cssPrev,c.container)[e||0===c.page?"addClass":"removeClass"](a),d(c.cssNext+","+c.cssLast,c.container)[e||c.page===c.totalPages-1?"addClass":"removeClass"](a))},t=function(c,b){b.startRow=b.size*b.page+1;b.endRow=Math.min(b.totalRows,b.size*(b.page+1));var a=d(b.cssPageDisplay,b.container),e=b.output.replace(/\{(page|totalPages|startRow|endRow|totalRows)\}/gi,function(a){return{"{page}":b.page+1,"{totalPages}":b.totalPages, "{startRow}":b.startRow,"{endRow}":b.endRow,"{totalRows}":b.totalRows}[a]});if(a[0])a["INPUT"===a[0].tagName?"val":"html"](e);i(b);d(c).trigger("pagerComplete",b)},o=function(c,b){var a,e=d(c.tBodies[0]);if(b.fixedHeight&&(e.find("tr.pagerSavedHeightSpacer").remove(),a=d.data(c,"pagerSavedHeight")))a-=e.height(),5<a&&d.data(c,"pagerLastSize")===b.size&&e.find("tr:visible").length<b.size&&e.append('<tr class="pagerSavedHeightSpacer remove-me" style="height:'+a+'px;"></tr>')},l=function(c,b){var a, e=d("tr:not(."+c.config.cssChildRow+")",c.tBodies[0]),g=e.length,f=b.page*b.size,n=f+b.size;n>g&&(n=g);for(a=0;a<g;a++)e[a].style.display=a>=f&&a<n?"":"none"},u=function(c,b){b.size=parseInt(d(b.cssPageSize,b.container).val(),10);d.data(c,"pagerLastSize",b.size);i(b);b.removeRows||(l(c,b),d(c).bind("sortEnd.pager",function(){l(c,b);d(c).trigger("applyWidgets")}))},v=function(c,b){var a,e=d(c),g=d(c.tBodies[0]),f=b.ajaxUrl.replace(/\{page\}/g,b.page).replace(/\{size\}/g,b.size);""!==f&&(a=d("<div/>", {id:"tablesorterPagerLoading",width:e.outerWidth(!0),height:e.outerHeight(!0)}),e.before(a),d.getJSON(f,function(f){if("function"===typeof b.ajaxProcessing){var f=b.ajaxProcessing(f),r=f[0],j=r.length,m,p,q=[],k="",h="",i=d(c).addClass("hasStickyHeaders"),l=e.find("."+(c.config.widgetOptions&&c.config.widgetOptions.stickyHeaders||"tablesorter-stickyheader"));for(m=0;m<j;m++){k+="<tr>";for(p in r[m])"string"===typeof p&&(0===m&&q.push(p),k+="<td>"+r[m][p]+"</td>");k+="</tr>"}e.find("thead tr.tablesorter-header th").each(function(b){var a= d(this),a=a.find("span").length?a.find("span:first"):a;a.html(q[b]);i&&l.length&&(a=l.find("th").eq(b),a=a.find("span").length?a.find("span:first"):a,a.html(q[b]));h+="<th>"+q[b]+"</th>"});e.find("tfoot").html("<tr>"+h+"</tr>");g.html(k);a.remove();e.trigger("update");b.totalRows=f[1];b.totalPages=Math.ceil(b.totalRows/b.size);t(c,b);o(c,b);e.trigger("pagerChange",b)}}))},s=function(c,b,a){var e,g,f,n=d(c.tBodies[0]),h=b.length;e=a.page*a.size;var i=e+a.size;if(!(1>h)){d(c).trigger("pagerChange", a);if(a.removeRows){i>b.length&&(i=b.length);for(d(c.tBodies[0]).empty();e<i;e++){f=b[e];h=f.length;for(g=0;g<h;g++)n[0].appendChild(f[g])}}else l(c,a);d(c).trigger("applyWidgets");a.page>=a.totalPages&&(a.page=a.totalPages-1,j(c,a));t(c,a);a.isDisabled||o(c,a)}},w=function(c,b){b.ajax?i(b,!0):(b.isDisabled=!0,d.data(c,"pagerLastPage",b.page),d.data(c,"pagerLastSize",b.size),b.page=0,b.size=b.totalRows,b.totalPages=1,d("tr.pagerSavedHeightSpacer",c.tBodies[0]).remove(),s(c,c.config.rowsCopy,b));d(b.cssPageSize, b.container).addClass(b.cssDisabled)[0].disabled=!0},j=function(c,b){if(!b.isDisabled){if(0>b.page||b.page>b.totalPages-1)b.page=0;d.data(c,"pagerLastPage",b.page);b.ajax?v(c,b):s(c,c.config.rowsCopy,b)}},x=function(c,b,a){a.size=b;d.data(c,"pagerLastPage",a.page);d.data(c,"pagerLastSize",a.size);a.totalPages=Math.ceil(a.totalRows/a.size);j(c,a)},y=function(c,b,a){var e=d(b.cssPageSize,b.container).removeClass(b.cssDisabled).removeAttr("disabled");b.isDisabled=!1;b.page=d.data(c,"pagerLastPage")|| 0;b.size=d.data(c,"pagerLastSize")||parseInt(e.val(),10);b.totalPages=Math.ceil(b.totalRows/b.size);a&&(d("table").trigger("update"),x(c,b.size,b),u(c,b),o(c,b))};h.appender=function(c,b){var a=c.config.pager;a.ajax||(c.config.rowsCopy=b,a.totalRows=b.length,a.size=d.data(c,"pagerLastSize")||a.size,a.totalPages=Math.ceil(a.totalRows/a.size),s(c,b,a))};h.construct=function(c){return this.each(function(){var b=this.config,a=b.pager=d.extend({},d.tablesorterPager.defaults,c),e=this,g=d(e),f=d(a.container).show(); b.appender=h.appender;y(e,a,!1);"string"===typeof a.ajaxUrl?(a.ajax=!0,v(e,a)):(a.ajax=!1,d(this).trigger("appendCache"),u(e,a));d(a.cssFirst,f).unbind("click.pager").bind("click.pager",function(){if(!d(this).hasClass(a.cssDisabled)){a.page=0;j(e,a)}return false});d(a.cssNext,f).unbind("click.pager").bind("click.pager",function(){if(!d(this).hasClass(a.cssDisabled)){a.page++;if(a.page>=a.totalPages-1)a.page=a.totalPages-1;j(e,a)}return false});d(a.cssPrev,f).unbind("click.pager").bind("click.pager", function(){if(!d(this).hasClass(a.cssDisabled)){a.page--;if(a.page<=0)a.page=0;j(e,a)}return false});d(a.cssLast,f).unbind("click.pager").bind("click.pager",function(){if(!d(this).hasClass(a.cssDisabled)){a.page=a.totalPages-1;j(e,a)}return false});d(a.cssPageSize,f).unbind("change.pager").bind("change.pager",function(){d(a.cssPageSize,f).val(d(this).val());if(!d(this).hasClass(a.cssDisabled)){x(e,parseInt(d(this).val(),10),a);var b=d(e.tBodies[0]);b.find("tr.pagerSavedHeightSpacer").remove();d.data(e, "pagerSavedHeight",b.height());o(e,a);d.data(e,"pagerLastSize",a.size)}return false});g.unbind("disable.pager enable.pager destroy.pager").bind("disable.pager",function(){w(e,a)}).bind("enable.pager",function(){y(e,a,true)}).bind("destroy.pager",function(){w(e,a);a.container.hide();e.config.appender=null;d(e).unbind("destroy.pager sortEnd.pager enable.pager disable.pager")})})}}});d.fn.extend({tablesorterPager:d.tablesorterPager.construct})})(jQuery);
28 docs/example-pager-ajax.html
View
@@ -21,7 +21,33 @@
<link rel="stylesheet" href="../addons/pager/jquery.tablesorter.pager.css">
<script src="../addons/pager/jquery.tablesorter.pager.js"></script>
- <style id="css">/*** css used when "updateArrows" option is true ***/
+ <style id="css">div.tablesorterPager {
+ padding: 10px 0 10px 0;
+ background-color: #D6D2C2;
+ text-align: center;
+}
+div.tablesorterPager span {
+ padding: 0 5px 0 5px;
+}
+div.tablesorterPager input.prev {
+ width: auto;
+ margin-right: 10px;
+}
+div.tablesorterPager input.next {
+ width: auto;
+ margin-left: 10px;
+}
+div.tablesorterPager input {
+ font-size: 8px;
+ width: 50px;
+ border: 1px solid #330000;
+ text-align: center;
+}
+#tablesorterPagerLoading {
+ background: rgba(255,255,255,0.8) url(icons/loading.gif) center center no-repeat;
+ position: absolute;
+ z-index: 1000;
+}/*** css used when "updateArrows" option is true ***/
/* the pager itself gets a disabled class when the number of rows is less than the size */
.pager.disabled {
display: none;
28 docs/example-pager.html
View
@@ -21,7 +21,33 @@
<link rel="stylesheet" href="../addons/pager/jquery.tablesorter.pager.css">
<script src="../addons/pager/jquery.tablesorter.pager.js"></script>
- <style id="css">/*** css used when "updateArrows" option is true ***/
+ <style id="css">div.tablesorterPager {
+ padding: 10px 0 10px 0;
+ background-color: #D6D2C2;
+ text-align: center;
+}
+div.tablesorterPager span {
+ padding: 0 5px 0 5px;
+}
+div.tablesorterPager input.prev {
+ width: auto;
+ margin-right: 10px;
+}
+div.tablesorterPager input.next {
+ width: auto;
+ margin-left: 10px;
+}
+div.tablesorterPager input {
+ font-size: 8px;
+ width: 50px;
+ border: 1px solid #330000;
+ text-align: center;
+}
+#tablesorterPagerLoading {
+ background: rgba(255,255,255,0.8) url(icons/loading.gif) center center no-repeat;
+ position: absolute;
+ z-index: 1000;
+}/*** css used when "updateArrows" option is true ***/
/* the pager itself gets a disabled class when the number of rows is less than the size */
.pager.disabled {
display: none;
4 index.html
View
@@ -12,7 +12,7 @@
<!-- Pick a theme, load the plugin & initialize plugin -->
<link href="css/blue/style.css" rel="stylesheet">
- <script src="js/jquery.tablesorter.js"></script>
+ <script src="js/jquery.tablesorter.min.js"></script>
<script src="js/jquery.tablesorter.widgets.js"></script>
<script>
$(function(){
@@ -34,7 +34,7 @@
<table class="tablesorter">
<thead>
<tr>
- <th>AlphaNumeric Sort *New*</th>
+ <th>AlphaNumeric Sort</th>
<th>Currency</th>
<th>Alphabetical</th>
<th>Sites</th>
1  js/jquery.tablesorter.js
View
@@ -363,6 +363,7 @@
}
// add cell to headerList
c.headerList[index] = this;
+ $(this).parent().addClass('tablesorter-header');
});
if (c.debug) {
benchmark("Built headers", time);
2  js/jquery.tablesorter.min.js
View
@@ -4,4 +4,4 @@
* Copyright (c) 2007 Christian Bach
*/
-!(function($){$.extend({tablesorter:new function(){var g=[],widgets=[],tbl;this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:false,sortReset:false,sortRestart:false,textExtraction:"simple",parsers:{},widgets:[],headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"mmddyyyy",onRenderHeader:null,selectorHeaders:'thead th',selectorRemove:"tr.remove-me",tableClass:'tablesorter',debug:false,widgetOptions:{zebra:["even","odd"]}};function log(s){if(typeof console!=="undefined"&&typeof console.log!=="undefined"){console.log(s)}else{alert(s)}}function benchmark(s,d){log(s+" ("+(new Date().getTime()-d.getTime())+"ms)")}this.benchmark=benchmark;this.hasInitialized=false;function getElementText(a,b,c){var d="",te=a.textExtraction;if(!b){return""}if(!a.supportsTextContent){a.supportsTextContent=b.textContent||false}if(te==="simple"){if(a.supportsTextContent){d=b.textContent}else{if(b.childNodes[0]&&b.childNodes[0].hasChildNodes()){d=b.childNodes[0].innerHTML}else{d=b.innerHTML}}}else{if(typeof(te)==="function"){d=te(b)}else if(typeof(te)==="object"&&te.hasOwnProperty(c)){d=te[c](b)}else{d=$(b).text()}}return d}function getParserById(a){var i,l=g.length;for(i=0;i<l;i++){if(g[i].id.toLowerCase()===(a.toString()).toLowerCase()){return g[i]}}return false}function trimAndGetNodeText(a,b,c){return $.trim(getElementText(a,b,c))}function detectParserForColumn(a,b,c,d){var i,l=g.length,node=false,nodeValue='',keepLooking=true;while(nodeValue===''&&keepLooking){c++;if(b[c]){node=b[c].cells[d];nodeValue=trimAndGetNodeText(a.config,node,d);if(a.config.debug){log('Checking if value was empty on row '+c+', column:'+d+": "+nodeValue)}}else{keepLooking=false}}for(i=1;i<l;i++){if(g[i].is(nodeValue,a,node)){return g[i]}}return g[0]}function buildParserCache(a,b){if(a.tBodies.length===0){return}var c=a.tBodies[0].rows,list,cells,l,h,i,p,parsersDebug="";if(c[0]){list=[];cells=c[0].cells;l=cells.length;for(i=0;i<l;i++){p=false;h=$(b[i]);if($.metadata&&(h.metadata()&&h.metadata().sorter)){p=getParserById(h.metadata().sorter)}else if((a.config.headers[i]&&a.config.headers[i].sorter)){p=getParserById(a.config.headers[i].sorter)}else if(h.attr('class')&&h.attr('class').match('sorter-')){p=getParserById(h.attr('class').match(/sorter-(\w+)/)[1]||'')}if(!p){p=detectParserForColumn(a,c,-1,i)}if(a.config.debug){parsersDebug+="column:"+i+"; parser:"+p.id+"\n"}list.push(p)}}if(a.config.debug){log(parsersDebug)}return list}function buildCache(a){var b=a.tBodies[0],totalRows=(b&&b.rows.length)||0,totalCells=(b.rows[0]&&b.rows[0].cells.length)||0,g=a.config.parsers,cache={row:[],normalized:[]},t,i,j,c,cols,cacheTime;if(a.config.debug){cacheTime=new Date()}for(i=0;i<totalRows;++i){c=$(b.rows[i]);cols=[];if(c.hasClass(a.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue}cache.row.push(c);for(j=0;j<totalCells;++j){t=trimAndGetNodeText(a.config,c[0].cells[j],j);cols.push(t===''?'':g[j].format(t,a,c[0].cells[j],j))}cols.push(cache.normalized.length);cache.normalized.push(cols)}if(a.config.debug){benchmark("Building cache for "+totalRows+" rows",cacheTime)}a.config.cache=cache;return cache}function getWidgetById(a){var i,w,l=widgets.length;for(i=0;i<l;i++){w=widgets[i];if(w&&w.hasOwnProperty('id')&&w.id.toLowerCase()===a.toLowerCase()){return w}}}function applyWidget(a,b){var c=a.config.widgets,i,w,l=c.length;for(i=0;i<l;i++){w=getWidgetById(c[i]);if(w){if(b&&w.hasOwnProperty('init')){w.init(a,widgets,w)}else if(!b&&w.hasOwnProperty('format')){w.format(a)}}}}function appendToTable(a,b){var c=a.config,r=b.row,n=b.normalized,totalRows=n.length,checkCell=totalRows?(n[0].length-1):0,rows=[],i,j,l,pos,appendTime;if(c.debug){appendTime=new Date()}for(i=0;i<totalRows;i++){pos=n[i][checkCell];rows.push(r[pos]);if(!c.appender||!c.removeRows){l=r[pos].length;for(j=0;j<l;j++){a.tBodies[0].appendChild(r[pos][j])}}}if(c.appender){c.appender(a,rows)}if(c.debug){benchmark("Rebuilt table",appendTime)}applyWidget(a);setTimeout(function(){$(a).trigger("sortEnd",a)},0)}function computeTableHeaderCellIndexes(t){var a=[],lookup={},thead=t.getElementsByTagName('THEAD')[0],trs=thead.getElementsByTagName('TR'),i,j,k,l,c,cells,rowIndex,cellId,rowSpan,colSpan,firstAvailCol,matrixrow;for(i=0;i<trs.length;i++){cells=trs[i].cells;for(j=0;j<cells.length;j++){c=cells[j];rowIndex=c.parentNode.rowIndex;cellId=rowIndex+"-"+c.cellIndex;rowSpan=c.rowSpan||1;colSpan=c.colSpan||1;if(typeof(a[rowIndex])==="undefined"){a[rowIndex]=[]}for(k=0;k<a[rowIndex].length+1;k++){if(typeof(a[rowIndex][k])==="undefined"){firstAvailCol=k;break}}lookup[cellId]=firstAvailCol;for(k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(a[k])==="undefined"){a[k]=[]}matrixrow=a[k];for(l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x"}}}}return lookup}function formatSortingOrder(v){return(/^d/i.test(v)||v===1)}function checkHeaderMetadata(a){return(($.metadata)&&($(a).metadata().sorter===false))}function checkHeaderOptions(a,i){return((a.config.headers[i])&&(a.config.headers[i].sorter===false))}function checkHeaderLocked(a,i){if((a.config.headers[i])&&(a.config.headers[i].lockedOrder!==null)){return a.config.headers[i].lockedOrder}return false}function checkHeaderOrder(a,i){if((a.config.headers[i])&&(a.config.headers[i].sortInitialOrder)){return a.config.headers[i].sortInitialOrder}return a.config.sortInitialOrder}function buildHeaders(b){var d=($.metadata)?true:false,header_index=computeTableHeaderCellIndexes(b),$th,lock,time,$tableHeaders,c=b.config;c.headerList=[];if(c.debug){time=new Date()}$tableHeaders=$(c.selectorHeaders,b).wrapInner("<span/>").each(function(a){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(checkHeaderOrder(b,a))?[1,0,2]:[0,1,2];this.count=-1;if(checkHeaderMetadata(this)||checkHeaderOptions(b,a)||$(this).is('.sorter-false')){this.sortDisabled=true}this.lockedOrder=false;lock=checkHeaderLocked(b,a);if(typeof(lock)!=='undefined'&&lock!==false){this.order=this.lockedOrder=formatSortingOrder(lock)?[1,1,1]:[0,0,0]}if(!this.sortDisabled){$th=$(this).addClass(c.cssHeader);if(c.onRenderHeader){c.onRenderHeader.apply($th,[a])}}c.headerList[a]=this});if(c.debug){benchmark("Built headers",time);log($tableHeaders)}return $tableHeaders}function checkCellColSpan(a,b,d){var i,cell,arr=[],r=a.tHead.rows,c=r[d].cells;for(i=0;i<c.length;i++){cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(a,b,d++))}else{if(a.tHead.length===1||(cell.rowSpan>1||!r[d+1])){arr.push(cell)}}}return arr}function isValueInArray(v,a){var i,l=a.length;for(i=0;i<l;i++){if(a[i][0]===v){return true}}return false}function setHeadersCss(b,c,d){var h=[],i,l,css=[b.config.cssDesc,b.config.cssAsc];c.removeClass(css[0]).removeClass(css[1]);c.each(function(a){if(!this.sortDisabled){h[this.column]=$(this)}});l=d.length;for(i=0;i<l;i++){if(d[i][1]===2){continue}h[d[i][0]].addClass(css[d[i][1]])}}function fixColumnWidth(a,b){if(a.config.widthFixed){var c=$('<colgroup>');$("tr:first td",a.tBodies[0]).each(function(){c.append($('<col>').css('width',$(this).width()))});$(a).prepend(c)}}function updateHeaderSortCount(a,b){var i,s,o,c=a.config,l=b.length;for(i=0;i<l;i++){s=b[i];o=c.headerList[s[0]];o.count=(s[1]+1)%(c.sortReset?3:2)}}function getCachedSortType(a,i){return(a)?a[i].type:''}function multisort(a,b,d){var f="var sortWrapper = function(a,b) {",col,mx=0,dir=0,tc=a.config,lc=d.normalized.length,l=b.length,sortTime,i,j,c,s,e,order,orgOrderCol;if(tc.debug){sortTime=new Date()}for(i=0;i<l;i++){c=b[i][0];order=b[i][1];s=(getCachedSortType(tc.parsers,c)==="text")?((order===0)?"sortText":"sortTextDesc"):((order===0)?"sortNumeric":"sortNumericDesc");e="e"+i;if(/Numeric/.test(s)&&tc.headers[c]&&tc.headers[c].string){for(j=0;j<lc;j++){col=Math.abs(parseFloat(d.normalized[j][c]));mx=Math.max(mx,isNaN(col)?0:col)}dir=(tc.headers[c])?tc.string[tc.headers[c].string]||0:0}f+="var "+e+" = "+s+"(a["+c+"],b["+c+"],"+mx+","+dir+"); ";f+="if ("+e+") { return "+e+"; } ";f+="else { "}orgOrderCol=(d.normalized&&d.normalized[0])?d.normalized[0].length-1:0;f+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(i=0;i<l;i++){f+="}; "}f+="return 0; ";f+="}; ";eval(f);d.normalized.sort(sortWrapper);if(tc.debug){benchmark("Sorting on "+b.toString()+" and dir "+order+" time",sortTime)}return d}function sortText(a,b){if(a===''){return 1}if(b===''){return-1}if(a===b){return 0}if($.data(tbl[0],"tablesorter").sortLocaleCompare){return a.localeCompare(b)}try{var c=0,ax,t,x=/^(\.)?\d/,L=Math.min(a.length,b.length)+1;while(c<L&&a.charAt(c)===b.charAt(c)&&x.test(b.substring(c))===false&&x.test(a.substring(c))===false){c++}a=a.substring(c);b=b.substring(c);if(x.test(a)||x.test(b)){if(x.test(a)===false){return(a)?1:-1}else if(x.test(b)===false){return(b)?-1:1}else{t=parseFloat(a)-parseFloat(b);if(t!==0){return t}else{t=a.search(/[^\.\d]/)}if(t===-1){t=b.search(/[^\.\d]/)}a=a.substring(t);b=b.substring(t)}}return(a>b)?1:-1}catch(er){return 0}}function sortTextDesc(a,b){if(a===''){return 1}if(b===''){return-1}if(a===b){return 0}if($.data(tbl[0],"tablesorter").sortLocaleCompare){return b.localeCompare(a)}return-sortText(a,b)}function getTextValue(a,b,d){if(b){var i,l=a.length,n=b+d;for(i=0;i<l;i++){n+=a.charCodeAt(i)}return d*n}return 0}function sortNumeric(a,b,c,d){if(a===''){return 1}if(b===''){return-1}if(isNaN(a)){a=getTextValue(a,c,d)}if(isNaN(b)){b=getTextValue(b,c,d)}return a-b}function sortNumericDesc(a,b,c,d){if(a===''){return 1}if(b===''){return-1}if(isNaN(a)){a=getTextValue(a,c,d)}if(isNaN(b)){b=getTextValue(b,c,d)}return b-a}this.construct=function(f){return this.each(function(){if(!this.tHead||this.tBodies.length===0){return}var d,$document,$headers,cache,config,shiftDown=0,sortOrder,totalRows,$cell,c,i,j,a,s,o;this.config={};c=config=$.extend(true,this.config,$.tablesorter.defaults,f);tbl=d=$(this).addClass(this.config.tableClass);$.data(this,"tablesorter",c);$headers=buildHeaders(this);c.parsers=buildParserCache(this,$headers);c.string={max:1,'max+':1,'max-':-1,none:0};cache=buildCache(this);fixColumnWidth(this);$headers.click(function(e){totalRows=(d[0].tBodies[0]&&d[0].tBodies[0].rows.length)||0;if(!this.sortDisabled){d.trigger("sortStart",tbl[0]);$cell=$(this);this.count=(this.count+1)%(c.sortReset?3:2);if(c.sortRestart){i=this;$headers.each(function(){if(this!==i&&(!$(this).is('.'+c.cssDesc+',.'+c.cssAsc)||!e[c.sortMultiSortKey])){this.count=-1}})}i=this.column;if(!e[c.sortMultiSortKey]){c.sortList=[];if(c.sortForce!==null){a=c.sortForce;for(j=0;j<a.length;j++){if(a[j][0]!==i){c.sortList.push(a[j])}}}if(this.order[this.count]<2){c.sortList.push([i,this.order[this.count]])}}else{if(isValueInArray(i,c.sortList)){for(j=0;j<c.sortList.length;j++){s=c.sortList[j];o=c.headerList[s[0]];if(s[0]===i){s[1]=o.order[o.count];if(s[1]===2){c.sortList.splice(j,1);o.count=-1}}}}else{if(this.order[this.count]<2){c.sortList.push([i,this.order[this.count]])}}}if(c.sortAppend!==null){a=c.sortAppend;for(j=0;j<a.length;j++){if(a[j][0]!==i){c.sortList.push(a[j])}}}d.trigger("sortBegin",tbl[0]);setTimeout(function(){setHeadersCss(d[0],$headers,c.sortList);appendToTable(d[0],multisort(d[0],c.sortList,cache))},1);return false}}).mousedown(function(){if(c.cancelSelection){this.onselectstart=function(){return false};return false}});d.bind("update",function(){var t=this,c=t.config;setTimeout(function(){$(c.selectorRemove,t.tBodies[0]).remove();t.config.parsers=buildParserCache(t,$headers);cache=buildCache(t);d.trigger("sorton",[t.config.sortList])},1)}).bind("updateCell",function(e,a){var b=[(a.parentNode.rowIndex-1),a.cellIndex];cache.normalized[b[0]][b[1]]=c.parsers[b[1]].format(getElementText(c,a,b[1]),d,a,b[1]);c.cache=cache;d.trigger("sorton",[c.sortList])}).bind("addRows",function(e,a){var i,rows=a.filter('tr').length,dat=[],l=a[0].cells.length;for(i=0;i<rows;i++){for(j=0;j<l;j++){dat[j]=c.parsers[j].format(getElementText(c,a[i].cells[j],j),d,a[i].cells[j],j)}dat.push(cache.row.length);cache.row.push([a[i]]);cache.normalized.push(dat);dat=[]}c.cache=cache;d.trigger("sorton",[c.sortList])}).bind("sorton",function(e,a){$(this).trigger("sortStart",tbl[0]);c.sortList=a;var b=c.sortList;updateHeaderSortCount(this,b);setHeadersCss(this,$headers,b);appendToTable(this,multisort(this,b,cache))}).bind("appendCache",function(){appendToTable(this,cache)}).bind("applyWidgetId",function(e,a){getWidgetById(a).format(this)}).bind("applyWidgets",function(){applyWidget(this)});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){c.sortList=$(this).metadata().sortlist}applyWidget(this,true);if(c.sortList.length>0){d.trigger("sorton",[c.sortList])}else{applyWidget(this)}this.hasInitialized=true})};this.addParser=function(b){var i,l=g.length,a=true;for(i=0;i<l;i++){if(g[i].id.toLowerCase()===b.id.toLowerCase()){a=false}}if(a){g.push(b)}};this.addWidget=function(a){widgets.push(a)};this.formatFloat=function(s){var i=parseFloat(s);return isNaN(i)?$.trim(s):i};this.isDigit=function(s){return(/^[\-+]?\d*$/).test($.trim(s.replace(/[,.']/g,'')))};this.clearTableBody=function(a){$(a.tBodies[0]).empty()}}})();$.fn.extend({tablesorter:$.tablesorter.construct});var m=$.tablesorter;m.addParser({id:"text",is:function(s){return true},format:function(s){return $.trim(s.toLocaleLowerCase())},type:"text"});m.addParser({id:"digit",is:function(s){return $.tablesorter.isDigit(s.replace(/,/g,""))},format:function(s){return $.tablesorter.formatFloat(s.replace(/,/g,""))},type:"numeric"});m.addParser({id:"currency",is:function(s){return(/^[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]/).test(s)},format:function(s){return $.tablesorter.formatFloat(s.replace(/\,/g,'.').replace(new RegExp(/[^0-9. \-]/g),""))},type:"numeric"});m.addParser({id:"ipAddress",is:function(s){return(/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/).test(s)},format:function(s){var i,item,a=s.split("."),r="",l=a.length;for(i=0;i<l;i++){item=a[i];if(item.length===2){r+="0"+item}else{r+=item}}return $.tablesorter.formatFloat(r)},type:"numeric"});m.addParser({id:"url",is:function(s){return(/^(https?|ftp|file):\/\/$/).test(s)},format:function(s){return $.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''))},type:"text"});m.addParser({id:"isoDate",is:function(s){return(/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/).test(s)},format:function(s){return $.tablesorter.formatFloat((s!=="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0")},type:"numeric"});m.addParser({id:"percent",is:function(s){return(/\%$/).test($.trim(s))},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""))},type:"numeric"});m.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/))},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});m.addParser({id:"shortDate",is:function(s){return(/\d{1,4}[\/\-\,\.\s+]\d{1,4}[\/\-\.\,\s+]\d{1,4}/).test(s)},format:function(s,a,b,d){var c=a.config,format=(c.headers&&c.headers[d])?c.headers[d].dateFormat||c.dateFormat:c.dateFormat;s=s.replace(/\s+/g," ").replace(/[\-|\.|\,|\s]/g,"/");if(format==="mmddyyyy"){s=s.replace(/(\d{1,2})\/(\d{1,2})\/(\d{4})/,"$3/$1/$2")}else if(format==="ddmmyyyy"){s=s.replace(/(\d{1,2})\/(\d{1,2})\/(\d{4})/,"$3/$2/$1")}else if(format==="yyyymmdd"){s=s.replace(/(\d{4})\/(\d{1,2})\/(\d{1,2})/,"$1/$2/$3")}return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});m.addParser({id:"time",is:function(s){return(/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/).test(s)},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime())},type:"numeric"});m.addParser({id:"metadata",is:function(s){return false},format:function(s,a,b){var c=a.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(b).metadata()[p]},type:"numeric"});m.addWidget({id:"zebra",format:function(a){var b,row=0,even,time,c=a.config,child=c.cssChildRow,css=["even","odd"];css=c.widgetZebra&&c.hasOwnProperty('css')?c.widgetZebra.css:(c.widgetOptions&&c.widgetOptions.hasOwnProperty('zebra'))?c.widgetOptions.zebra:css;if(a.config.debug){time=new Date()}$("tr:visible",a.tBodies[0]).each(function(i){b=$(this);if(!b.hasClass(child)){row++}even=(row%2===0);b.removeClass(css[even?1:0]).addClass(css[even?0:1])});if(a.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time)}}})})(jQuery);
+!(function($){$.extend({tablesorter:new function(){var g=[],widgets=[],tbl;this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:false,sortReset:false,sortRestart:false,textExtraction:"simple",parsers:{},widgets:[],headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"mmddyyyy",onRenderHeader:null,selectorHeaders:'thead th',selectorRemove:"tr.remove-me",tableClass:'tablesorter',debug:false,widgetOptions:{zebra:["even","odd"]}};function log(s){if(typeof console!=="undefined"&&typeof console.log!=="undefined"){console.log(s)}else{alert(s)}}function benchmark(s,d){log(s+" ("+(new Date().getTime()-d.getTime())+"ms)")}this.benchmark=benchmark;this.hasInitialized=false;function getElementText(a,b,c){var d="",te=a.textExtraction;if(!b){return""}if(!a.supportsTextContent){a.supportsTextContent=b.textContent||false}if(te==="simple"){if(a.supportsTextContent){d=b.textContent}else{if(b.childNodes[0]&&b.childNodes[0].hasChildNodes()){d=b.childNodes[0].innerHTML}else{d=b.innerHTML}}}else{if(typeof(te)==="function"){d=te(b)}else if(typeof(te)==="object"&&te.hasOwnProperty(c)){d=te[c](b)}else{d=$(b).text()}}return d}function getParserById(a){var i,l=g.length;for(i=0;i<l;i++){if(g[i].id.toLowerCase()===(a.toString()).toLowerCase()){return g[i]}}return false}function trimAndGetNodeText(a,b,c){return $.trim(getElementText(a,b,c))}function detectParserForColumn(a,b,c,d){var i,l=g.length,node=false,nodeValue='',keepLooking=true;while(nodeValue===''&&keepLooking){c++;if(b[c]){node=b[c].cells[d];nodeValue=trimAndGetNodeText(a.config,node,d);if(a.config.debug){log('Checking if value was empty on row '+c+', column:'+d+": "+nodeValue)}}else{keepLooking=false}}for(i=1;i<l;i++){if(g[i].is(nodeValue,a,node)){return g[i]}}return g[0]}function buildParserCache(a,b){if(a.tBodies.length===0){return}var c=a.tBodies[0].rows,list,cells,l,h,i,p,parsersDebug="";if(c[0]){list=[];cells=c[0].cells;l=cells.length;for(i=0;i<l;i++){p=false;h=$(b[i]);if($.metadata&&(h.metadata()&&h.metadata().sorter)){p=getParserById(h.metadata().sorter)}else if((a.config.headers[i]&&a.config.headers[i].sorter)){p=getParserById(a.config.headers[i].sorter)}else if(h.attr('class')&&h.attr('class').match('sorter-')){p=getParserById(h.attr('class').match(/sorter-(\w+)/)[1]||'')}if(!p){p=detectParserForColumn(a,c,-1,i)}if(a.config.debug){parsersDebug+="column:"+i+"; parser:"+p.id+"\n"}list.push(p)}}if(a.config.debug){log(parsersDebug)}return list}function buildCache(a){var b=a.tBodies[0],totalRows=(b&&b.rows.length)||0,totalCells=(b.rows[0]&&b.rows[0].cells.length)||0,g=a.config.parsers,cache={row:[],normalized:[]},t,i,j,c,cols,cacheTime;if(a.config.debug){cacheTime=new Date()}for(i=0;i<totalRows;++i){c=$(b.rows[i]);cols=[];if(c.hasClass(a.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue}cache.row.push(c);for(j=0;j<totalCells;++j){t=trimAndGetNodeText(a.config,c[0].cells[j],j);cols.push(t===''?'':g[j].format(t,a,c[0].cells[j],j))}cols.push(cache.normalized.length);cache.normalized.push(cols)}if(a.config.debug){benchmark("Building cache for "+totalRows+" rows",cacheTime)}a.config.cache=cache;return cache}function getWidgetById(a){var i,w,l=widgets.length;for(i=0;i<l;i++){w=widgets[i];if(w&&w.hasOwnProperty('id')&&w.id.toLowerCase()===a.toLowerCase()){return w}}}function applyWidget(a,b){var c=a.config.widgets,i,w,l=c.length;for(i=0;i<l;i++){w=getWidgetById(c[i]);if(w){if(b&&w.hasOwnProperty('init')){w.init(a,widgets,w)}else if(!b&&w.hasOwnProperty('format')){w.format(a)}}}}function appendToTable(a,b){var c=a.config,r=b.row,n=b.normalized,totalRows=n.length,checkCell=totalRows?(n[0].length-1):0,rows=[],i,j,l,pos,appendTime;if(c.debug){appendTime=new Date()}for(i=0;i<totalRows;i++){pos=n[i][checkCell];rows.push(r[pos]);if(!c.appender||!c.removeRows){l=r[pos].length;for(j=0;j<l;j++){a.tBodies[0].appendChild(r[pos][j])}}}if(c.appender){c.appender(a,rows)}if(c.debug){benchmark("Rebuilt table",appendTime)}applyWidget(a);setTimeout(function(){$(a).trigger("sortEnd",a)},0)}function computeTableHeaderCellIndexes(t){var a=[],lookup={},thead=t.getElementsByTagName('THEAD')[0],trs=thead.getElementsByTagName('TR'),i,j,k,l,c,cells,rowIndex,cellId,rowSpan,colSpan,firstAvailCol,matrixrow;for(i=0;i<trs.length;i++){cells=trs[i].cells;for(j=0;j<cells.length;j++){c=cells[j];rowIndex=c.parentNode.rowIndex;cellId=rowIndex+"-"+c.cellIndex;rowSpan=c.rowSpan||1;colSpan=c.colSpan||1;if(typeof(a[rowIndex])==="undefined"){a[rowIndex]=[]}for(k=0;k<a[rowIndex].length+1;k++){if(typeof(a[rowIndex][k])==="undefined"){firstAvailCol=k;break}}lookup[cellId]=firstAvailCol;for(k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(a[k])==="undefined"){a[k]=[]}matrixrow=a[k];for(l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x"}}}}return lookup}function formatSortingOrder(v){return(/^d/i.test(v)||v===1)}function checkHeaderMetadata(a){return(($.metadata)&&($(a).metadata().sorter===false))}function checkHeaderOptions(a,i){return((a.config.headers[i])&&(a.config.headers[i].sorter===false))}function checkHeaderLocked(a,i){if((a.config.headers[i])&&(a.config.headers[i].lockedOrder!==null)){return a.config.headers[i].lockedOrder}return false}function checkHeaderOrder(a,i){if((a.config.headers[i])&&(a.config.headers[i].sortInitialOrder)){return a.config.headers[i].sortInitialOrder}return a.config.sortInitialOrder}function buildHeaders(b){var d=($.metadata)?true:false,header_index=computeTableHeaderCellIndexes(b),$th,lock,time,$tableHeaders,c=b.config;c.headerList=[];if(c.debug){time=new Date()}$tableHeaders=$(c.selectorHeaders,b).wrapInner("<span/>").each(function(a){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(checkHeaderOrder(b,a))?[1,0,2]:[0,1,2];this.count=-1;if(checkHeaderMetadata(this)||checkHeaderOptions(b,a)||$(this).is('.sorter-false')){this.sortDisabled=true}this.lockedOrder=false;lock=checkHeaderLocked(b,a);if(typeof(lock)!=='undefined'&&lock!==false){this.order=this.lockedOrder=formatSortingOrder(lock)?[1,1,1]:[0,0,0]}if(!this.sortDisabled){$th=$(this).addClass(c.cssHeader);if(c.onRenderHeader){c.onRenderHeader.apply($th,[a])}}c.headerList[a]=this;$(this).parent().addClass('tablesorter-header')});if(c.debug){benchmark("Built headers",time);log($tableHeaders)}return $tableHeaders}function checkCellColSpan(a,b,d){var i,cell,arr=[],r=a.tHead.rows,c=r[d].cells;for(i=0;i<c.length;i++){cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(a,b,d++))}else{if(a.tHead.length===1||(cell.rowSpan>1||!r[d+1])){arr.push(cell)}}}return arr}function isValueInArray(v,a){var i,l=a.length;for(i=0;i<l;i++){if(a[i][0]===v){return true}}return false}function setHeadersCss(b,c,d){var h=[],i,l,css=[b.config.cssDesc,b.config.cssAsc];c.removeClass(css[0]).removeClass(css[1]);c.each(function(a){if(!this.sortDisabled){h[this.column]=$(this)}});l=d.length;for(i=0;i<l;i++){if(d[i][1]===2){continue}h[d[i][0]].addClass(css[d[i][1]])}}function fixColumnWidth(a,b){if(a.config.widthFixed){var c=$('<colgroup>');$("tr:first td",a.tBodies[0]).each(function(){c.append($('<col>').css('width',$(this).width()))});$(a).prepend(c)}}function updateHeaderSortCount(a,b){var i,s,o,c=a.config,l=b.length;for(i=0;i<l;i++){s=b[i];o=c.headerList[s[0]];o.count=(s[1]+1)%(c.sortReset?3:2)}}function getCachedSortType(a,i){return(a)?a[i].type:''}function multisort(a,b,d){var f="var sortWrapper = function(a,b) {",col,mx=0,dir=0,tc=a.config,lc=d.normalized.length,l=b.length,sortTime,i,j,c,s,e,order,orgOrderCol;if(tc.debug){sortTime=new Date()}for(i=0;i<l;i++){c=b[i][0];order=b[i][1];s=(getCachedSortType(tc.parsers,c)==="text")?((order===0)?"sortText":"sortTextDesc"):((order===0)?"sortNumeric":"sortNumericDesc");e="e"+i;if(/Numeric/.test(s)&&tc.headers[c]&&tc.headers[c].string){for(j=0;j<lc;j++){col=Math.abs(parseFloat(d.normalized[j][c]));mx=Math.max(mx,isNaN(col)?0:col)}dir=(tc.headers[c])?tc.string[tc.headers[c].string]||0:0}f+="var "+e+" = "+s+"(a["+c+"],b["+c+"],"+mx+","+dir+"); ";f+="if ("+e+") { return "+e+"; } ";f+="else { "}orgOrderCol=(d.normalized&&d.normalized[0])?d.normalized[0].length-1:0;f+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(i=0;i<l;i++){f+="}; "}f+="return 0; ";f+="}; ";eval(f);d.normalized.sort(sortWrapper);if(tc.debug){benchmark("Sorting on "+b.toString()+" and dir "+order+" time",sortTime)}return d}function sortText(a,b){if(a===''){return 1}if(b===''){return-1}if(a===b){return 0}if($.data(tbl[0],"tablesorter").sortLocaleCompare){return a.localeCompare(b)}try{var c=0,ax,t,x=/^(\.)?\d/,L=Math.min(a.length,b.length)+1;while(c<L&&a.charAt(c)===b.charAt(c)&&x.test(b.substring(c))===false&&x.test(a.substring(c))===false){c++}a=a.substring(c);b=b.substring(c);if(x.test(a)||x.test(b)){if(x.test(a)===false){return(a)?1:-1}else if(x.test(b)===false){return(b)?-1:1}else{t=parseFloat(a)-parseFloat(b);if(t!==0){return t}else{t=a.search(/[^\.\d]/)}if(t===-1){t=b.search(/[^\.\d]/)}a=a.substring(t);b=b.substring(t)}}return(a>b)?1:-1}catch(er){return 0}}function sortTextDesc(a,b){if(a===''){return 1}if(b===''){return-1}if(a===b){return 0}if($.data(tbl[0],"tablesorter").sortLocaleCompare){return b.localeCompare(a)}return-sortText(a,b)}function getTextValue(a,b,d){if(b){var i,l=a.length,n=b+d;for(i=0;i<l;i++){n+=a.charCodeAt(i)}return d*n}return 0}function sortNumeric(a,b,c,d){if(a===''){return 1}if(b===''){return-1}if(isNaN(a)){a=getTextValue(a,c,d)}if(isNaN(b)){b=getTextValue(b,c,d)}return a-b}function sortNumericDesc(a,b,c,d){if(a===''){return 1}if(b===''){return-1}if(isNaN(a)){a=getTextValue(a,c,d)}if(isNaN(b)){b=getTextValue(b,c,d)}return b-a}this.construct=function(f){return this.each(function(){if(!this.tHead||this.tBodies.length===0){return}var d,$document,$headers,cache,config,shiftDown=0,sortOrder,totalRows,$cell,c,i,j,a,s,o;this.config={};c=config=$.extend(true,this.config,$.tablesorter.defaults,f);tbl=d=$(this).addClass(this.config.tableClass);$.data(this,"tablesorter",c);$headers=buildHeaders(this);c.parsers=buildParserCache(this,$headers);c.string={max:1,'max+':1,'max-':-1,none:0};cache=buildCache(this);fixColumnWidth(this);$headers.click(function(e){totalRows=(d[0].tBodies[0]&&d[0].tBodies[0].rows.length)||0;if(!this.sortDisabled){d.trigger("sortStart",tbl[0]);$cell=$(this);this.count=(this.count+1)%(c.sortReset?3:2);if(c.sortRestart){i=this;$headers.each(function(){if(this!==i&&(!$(this).is('.'+c.cssDesc+',.'+c.cssAsc)||!e[c.sortMultiSortKey])){this.count=-1}})}i=this.column;if(!e[c.sortMultiSortKey]){c.sortList=[];if(c.sortForce!==null){a=c.sortForce;for(j=0;j<a.length;j++){if(a[j][0]!==i){c.sortList.push(a[j])}}}if(this.order[this.count]<2){c.sortList.push([i,this.order[this.count]])}}else{if(isValueInArray(i,c.sortList)){for(j=0;j<c.sortList.length;j++){s=c.sortList[j];o=c.headerList[s[0]];if(s[0]===i){s[1]=o.order[o.count];if(s[1]===2){c.sortList.splice(j,1);o.count=-1}}}}else{if(this.order[this.count]<2){c.sortList.push([i,this.order[this.count]])}}}if(c.sortAppend!==null){a=c.sortAppend;for(j=0;j<a.length;j++){if(a[j][0]!==i){c.sortList.push(a[j])}}}d.trigger("sortBegin",tbl[0]);setTimeout(function(){setHeadersCss(d[0],$headers,c.sortList);appendToTable(d[0],multisort(d[0],c.sortList,cache))},1);return false}}).mousedown(function(){if(c.cancelSelection){this.onselectstart=function(){return false};return false}});d.bind("update",function(){var t=this,c=t.config;setTimeout(function(){$(c.selectorRemove,t.tBodies[0]).remove();t.config.parsers=buildParserCache(t,$headers);cache=buildCache(t);d.trigger("sorton",[t.config.sortList])},1)}).bind("updateCell",function(e,a){var b=[(a.parentNode.rowIndex-1),a.cellIndex];cache.normalized[b[0]][b[1]]=c.parsers[b[1]].format(getElementText(c,a,b[1]),d,a,b[1]);c.cache=cache;d.trigger("sorton",[c.sortList])}).bind("addRows",function(e,a){var i,rows=a.filter('tr').length,dat=[],l=a[0].cells.length;for(i=0;i<rows;i++){for(j=0;j<l;j++){dat[j]=c.parsers[j].format(getElementText(c,a[i].cells[j],j),d,a[i].cells[j],j)}dat.push(cache.row.length);cache.row.push([a[i]]);cache.normalized.push(dat);dat=[]}c.cache=cache;d.trigger("sorton",[c.sortList])}).bind("sorton",function(e,a){$(this).trigger("sortStart",tbl[0]);c.sortList=a;var b=c.sortList;updateHeaderSortCount(this,b);setHeadersCss(this,$headers,b);appendToTable(this,multisort(this,b,cache))}).bind("appendCache",function(){appendToTable(this,cache)}).bind("applyWidgetId",function(e,a){getWidgetById(a).format(this)}).bind("applyWidgets",function(){applyWidget(this)});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){c.sortList=$(this).metadata().sortlist}applyWidget(this,true);if(c.sortList.length>0){d.trigger("sorton",[c.sortList])}else{applyWidget(this)}this.hasInitialized=true})};this.addParser=function(b){var i,l=g.length,a=true;for(i=0;i<l;i++){if(g[i].id.toLowerCase()===b.id.toLowerCase()){a=false}}if(a){g.push(b)}};this.addWidget=function(a){widgets.push(a)};this.formatFloat=function(s){var i=parseFloat(s);return isNaN(i)?$.trim(s):i};this.isDigit=function(s){return(/^[\-+]?\d*$/).test($.trim(s.replace(/[,.']/g,'')))};this.clearTableBody=function(a){$(a.tBodies[0]).empty()}}})();$.fn.extend({tablesorter:$.tablesorter.construct});var m=$.tablesorter;m.addParser({id:"text",is:function(s){return true},format:function(s){return $.trim(s.toLocaleLowerCase())},type:"text"});m.addParser({id:"digit",is:function(s){return $.tablesorter.isDigit(s.replace(/,/g,""))},format:function(s){return $.tablesorter.formatFloat(s.replace(/,/g,""))},type:"numeric"});m.addParser({id:"currency",is:function(s){return(/^[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]/).test(s)},format:function(s){return $.tablesorter.formatFloat(s.replace(/\,/g,'.').replace(new RegExp(/[^0-9. \-]/g),""))},type:"numeric"});m.addParser({id:"ipAddress",is:function(s){return(/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/).test(s)},format:function(s){var i,item,a=s.split("."),r="",l=a.length;for(i=0;i<l;i++){item=a[i];if(item.length===2){r+="0"+item}else{r+=item}}return $.tablesorter.formatFloat(r)},type:"numeric"});m.addParser({id:"url",is:function(s){return(/^(https?|ftp|file):\/\/$/).test(s)},format:function(s){return $.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''))},type:"text"});m.addParser({id:"isoDate",is:function(s){return(/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/).test(s)},format:function(s){return $.tablesorter.formatFloat((s!=="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0")},type:"numeric"});m.addParser({id:"percent",is:function(s){return(/\%$/).test($.trim(s))},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""))},type:"numeric"});m.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/))},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});m.addParser({id:"shortDate",is:function(s){return(/\d{1,4}[\/\-\,\.\s+]\d{1,4}[\/\-\.\,\s+]\d{1,4}/).test(s)},format:function(s,a,b,d){var c=a.config,format=(c.headers&&c.headers[d])?c.headers[d].dateFormat||c.dateFormat:c.dateFormat;s=s.replace(/\s+/g," ").replace(/[\-|\.|\,|\s]/g,"/");if(format==="mmddyyyy"){s=s.replace(/(\d{1,2})\/(\d{1,2})\/(\d{4})/,"$3/$1/$2")}else if(format==="ddmmyyyy"){s=s.replace(/(\d{1,2})\/(\d{1,2})\/(\d{4})/,"$3/$2/$1")}else if(format==="yyyymmdd"){s=s.replace(/(\d{4})\/(\d{1,2})\/(\d{1,2})/,"$1/$2/$3")}return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});m.addParser({id:"time",is:function(s){return(/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/).test(s)},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime())},type:"numeric"});m.addParser({id:"metadata",is:function(s){return false},format:function(s,a,b){var c=a.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(b).metadata()[p]},type:"numeric"});m.addWidget({id:"zebra",format:function(a){var b,row=0,even,time,c=a.config,child=c.cssChildRow,css=["even","odd"];css=c.widgetZebra&&c.hasOwnProperty('css')?c.widgetZebra.css:(c.widgetOptions&&c.widgetOptions.hasOwnProperty('zebra'))?c.widgetOptions.zebra:css;if(a.config.debug){time=new Date()}$("tr:visible",a.tBodies[0]).each(function(i){b=$(this);if(!b.hasClass(child)){row++}even=(row%2===0);b.removeClass(css[even?1:0]).addClass(css[even?0:1])});if(a.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time)}}})})(jQuery);
7 js/jquery.tablesorter.widgets.js
View
@@ -1,4 +1,4 @@
-/* TableSorter 2.1 Widgets - updated 3/7/2012
+/* TableSorter 2.1 Widgets - updated 3/8/2012
*
* jQuery UI Theme
* Column Styles
@@ -226,7 +226,8 @@ $.tablesorter.addWidget({
css = wo.stickyHeaders || 'tablesorter-stickyheader',
firstCell = hdrCells.eq(0),
brdr = parseInt(hdrCells.eq(0).css('border-left-width'),10),
- sticky = header.find('tr:not(.' + (wo.filter_cssFilter || 'tablesorter-filter') + ')').clone()
+ sticky = header.find('tr.tablesorter-header').clone()
+ .removeClass('tablesorter-header')
.addClass(css)
.css({
width : header.outerWidth() + brdr * 2,
@@ -239,7 +240,7 @@ $.tablesorter.addWidget({
}),
stkyCells = sticky.children(),
laststate;
- // update sticky header class names to match real header
+ // update sticky header class names to match real header after sorting
$table.bind('sortEnd', function(e,t){
var th = $(t).find('thead tr'),
sh = th.filter('.' + css).children();
6 js/jquery.tablesorter.widgets.min.js
View
@@ -1,11 +1,11 @@
-/* TableSorter 2.1 Widgets - updated 3/7/2012 */
+/* TableSorter 2.1 Widgets - updated 3/8/2012 */
(function(b){
b.tablesorter.storage=function(a,e,c){var d,g=!1;d={};var a=a.id||b(".tablesorter").index(b(a)),f=window.location.pathname;try{g=!!localStorage.getItem}catch(j){}c?(d[f]={},d[f][a]={},d[f][a]=c,g?localStorage[e]=JSON.stringify(d):(c=new Date,c.setTime(c.getTime()+31536E6),document.cookie=e+"="+JSON.stringify(d).replace(/\"/g,'"')+"; expires="+c.toGMTString()+"; path=/")):g?d=b.parseJSON(localStorage[e])||{}:(d=document.cookie.split(/[;\s|=]/),c=b.inArray(e,d)+1,d=0!==c?b.parseJSON(d[c])|| {}:{});return d&&d.hasOwnProperty(f)&&d[f].hasOwnProperty(a)?d[f][a]:{}};
b.tablesorter.addWidget({id:"uitheme",format:function(a){var e,c,d,g,f,j=b(a),i=a.config,h=i.widgetOptions,k=["ui-icon-arrowthick-2-n-s","ui-icon-arrowthick-1-s","ui-icon-arrowthick-1-n"],k=i.widgetUitheme&&i.widgetUitheme.hasOwnProperty("css")?i.widgetUitheme.css||k:h&&h.hasOwnProperty("uitheme")?h.uitheme:k;d=k.join(" ");i.debug&&(e=new Date);j.hasClass("ui-theme")||(j.addClass("ui-widget ui-widget-content ui-corner-all ui-theme"), b.each(i.headerList,function(){b(this).addClass("ui-widget-header ui-corner-all ui-state-default").append('<span class="ui-icon"/>').wrapInner('<div class="tablesorter-inner"/>').hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")})}));b.each(i.headerList,function(a){g=b(this);if(this.sortDisabled)g.find("span.ui-icon").removeClass(d+" ui-icon");else{c=g.hasClass(i.cssAsc)?k[1]:g.hasClass(i.cssDesc)?k[2]:g.hasClass(i.cssHeader)?k[0]:"";f=j.hasClass("hasStickyHeaders")? j.find("tr."+h.stickyHeaders||"tablesorter-stickyheader").find("th").eq(a).add(g):g;f[c===k[0]?"removeClass":"addClass"]("ui-state-active").find("span.ui-icon").removeClass(d).addClass(c)}});i.debug&&b.tablesorter.benchmark("Applying uitheme widget",e)}});
b.tablesorter.addWidget({id:"columns",format:function(a){var e,c,d,g,f=a.config,j=f.sortList,i=j.length,h=["primary","secondary","tertiary"],h=f.widgetColumns&&f.widgetColumns.hasOwnProperty("css")?f.widgetColumns.css||h:f.widgetOptions&&f.widgetOptions.hasOwnProperty("columns")? f.widgetOptions.columns||h:h;d=h.length-1;g=h.join(" ");f.debug&&(c=new Date);j&&j[0]?b("tr:visible",a.tBodies[0]).each(function(a){e=b(this).children().removeClass(g);e.eq(j[0][0]).addClass(h[0]);if(1<i)for(a=1;a<i;a++)e.eq(j[a][0]).addClass(h[a]||h[d])}):b("td",a.tBodies[0]).removeClass(g);f.debug&&b.tablesorter.benchmark("Applying Columns widget",c)}});
b.tablesorter.addWidget({id:"filter",format:function(a){if(!b(a).hasClass("hasFilters")){var e,c,d,g,f,j,i,h=a.config,k=h.widgetOptions,l=k.filter_cssFilter|| "tablesorter-filter",m=h.headerList.length,n=b(a).addClass("hasFilters"),a='<tr class="'+l+'">',o;h.debug&&(o=new Date);for(e=0;e<m;e++)a+='<td><input type="search" data-col="'+e+'" class="'+l,a+=h.headers[e]&&h.headers[e].hasOwnProperty("filter")&&!1===h.headers[e].filter||b(h.headerList[e]).is(".filter-false")?' disabled" disabled':'"',a+="></td>";n.find("thead").append(a+="</tr>").find("input."+l).bind("keyup search",function(){c=n.find("thead").find("input."+l).map(function(){return(b(this).val()|| "").toLowerCase()}).get();""===c.join("")?n.find("tr").show():n.find("tbody").find("tr:not(."+h.cssChildRow+")").each(function(){d=!0;j=b(this).nextUntil("tr:not(."+h.cssChildRow+")");g=j.length&&(k&&k.hasOwnProperty("filter_childRows")&&"undefined"!==typeof k.filter_childRows?k.filter_childRows:1)?j.text():"";i=b(this).find("td");for(e=0;e<m;e++)f=(i.eq(e).text()+g).toLowerCase().indexOf(c[e]),""!==c[e]&&(!k.filter_startsWith&&0<=f||k.filter_startsWith&&0===f)?d=d?!0:!1:""!==c[e]&&(d=!1);b(this)[d? "show":"hide"]();if(j.length)j[d?"show":"hide"]()});n.trigger("applyWidgets")});h.debug&&b.tablesorter.benchmark("Applying Filter widget",o)}}});
-b.tablesorter.addWidget({id:"stickyHeaders",format:function(a){if(!b(a).hasClass("hasStickyHeaders")){var e=b(a).addClass("hasStickyHeaders"),c=a.config.widgetOptions,d=b(window),g=b(a).find("thead"),f=g.find("tr").children(),j=c.stickyHeaders||"tablesorter-stickyheader",i=f.eq(0),h=parseInt(f.eq(0).css("border-left-width"),10),k=g.find("tr:not(."+(c.filter_cssFilter|| "tablesorter-filter")+")").clone().addClass(j).css({width:g.outerWidth()+2*h,position:"fixed",left:i.offset().left,marginLeft:-h,top:0,visibility:"hidden",zIndex:10}),l=k.children(),m;e.bind("sortEnd",function(a,c){var d=b(c).find("thead tr"),e=d.filter("."+j).children();d.filter(":not(."+j+")").children().each(function(a){e.eq(a).attr("class",b(this).attr("class"))})}).bind("pagerComplete",function(){d.resize()});f.each(function(a){var c=b(this);l.eq(a).width(c.width()).bind("click",function(a){c.trigger(a)}).bind("mousedown", function(){this.onselectstart=function(){return!1};return!1})});g.prepend(k);d.scroll(function(){var a=i.offset(),b=d.scrollTop(),b=b>a.top&&b<a.top+e.find("tbody").height()?"visible":"hidden";k.css({left:a.left-d.scrollLeft(),visibility:b});b!==m&&(d.resize(),m=b)}).resize(function(){k.css({left:i.offset().left-d.scrollLeft(),width:g.outerWidth()+2*h});l.each(function(a){b(this).width(f.eq(a).width())})})}}});
-b.tablesorter.addWidget({id:"resizable",format:function(a){if(!b(a).hasClass("hasResizable")){b(a).addClass("hasResizable"); var e,c,d=a.config,g=b(d.headerList).filter(":gt(0)"),f=0,j=null,i=null,h=function(){f=0;j=i=null;b(window).trigger("resize")};if(c=b.tablesorter.storage?b.tablesorter.storage(a,"tablesorter-resizable"):"")for(e in c)!isNaN(e)&&e<d.headerList.length&&b(d.headerList[e]).width(c[e]);g.each(function(){b(this).append('<div class="tablesorter-resizer" style="cursor:w-resize;position:absolute;height:100%;width:20px;left:-20px;top:0;z-index:1;"></div>').wrapInner('<div style="position:relative;height:100%;width:100%"></div>')}).bind("mousemove", function(a){if(0!==f&&j){var b=a.pageX-f;j.width()<-b||i&&i.width()<=b||(i.width(i.width()+b),f=a.pageX)}}).bind("mouseup",function(){c&&b.tablesorter.storage&&j&&(c[i.index()]=i.width(),b.tablesorter.storage(a,"tablesorter-resizable",c));h();return!1}).find(".tablesorter-resizer").bind("mousedown",function(a){j=b(a.target).closest("th");i=j.prev();f=a.pageX});b(a).find("thead").bind("mouseup mouseleave",function(){h()})}}});
+b.tablesorter.addWidget({id:"stickyHeaders",format:function(a){if(!b(a).hasClass("hasStickyHeaders")){var e=b(a).addClass("hasStickyHeaders"),c=a.config.widgetOptions,d=b(window),g=b(a).find("thead"),f=g.find("tr").children(),j=c.stickyHeaders||"tablesorter-stickyheader",i=f.eq(0),h=parseInt(f.eq(0).css("border-left-width"),10),k=g.find("tr.tablesorter-header").clone().removeClass("tablesorter-header").addClass(j).css({width:g.outerWidth()+ 2*h,position:"fixed",left:i.offset().left,marginLeft:-h,top:0,visibility:"hidden",zIndex:10}),l=k.children(),m;e.bind("sortEnd",function(a,c){var d=b(c).find("thead tr"),e=d.filter("."+j).children();d.filter(":not(."+j+")").children().each(function(a){e.eq(a).attr("class",b(this).attr("class"))})}).bind("pagerComplete",function(){d.resize()});f.each(function(a){var c=b(this);l.eq(a).width(c.width()).bind("click",function(a){c.trigger(a)}).bind("mousedown",function(){this.onselectstart=function(){return!1}; return!1})});g.prepend(k);d.scroll(function(){var a=i.offset(),b=d.scrollTop(),b=b>a.top&&b<a.top+e.find("tbody").height()?"visible":"hidden";k.css({left:a.left-d.scrollLeft(),visibility:b});b!==m&&(d.resize(),m=b)}).resize(function(){k.css({left:i.offset().left-d.scrollLeft(),width:g.outerWidth()+2*h});l.each(function(a){b(this).width(f.eq(a).width())})})}}});
+b.tablesorter.addWidget({id:"resizable",format:function(a){if(!b(a).hasClass("hasResizable")){b(a).addClass("hasResizable");var e,c,d=a.config, g=b(d.headerList).filter(":gt(0)"),f=0,j=null,i=null,h=function(){f=0;j=i=null;b(window).trigger("resize")};if(c=b.tablesorter.storage?b.tablesorter.storage(a,"tablesorter-resizable"):"")for(e in c)!isNaN(e)&&e<d.headerList.length&&b(d.headerList[e]).width(c[e]);g.each(function(){b(this).append('<div class="tablesorter-resizer" style="cursor:w-resize;position:absolute;height:100%;width:20px;left:-20px;top:0;z-index:1;"></div>').wrapInner('<div style="position:relative;height:100%;width:100%"></div>')}).bind("mousemove", function(a){if(0!==f&&j){var b=a.pageX-f;j.width()<-b||i&&i.width()<=b||(i.width(i.width()+b),f=a.pageX)}}).bind("mouseup",function(){c&&b.tablesorter.storage&&j&&(c[i.index()]=i.width(),b.tablesorter.storage(a,"tablesorter-resizable",c));h();return!1}).find(".tablesorter-resizer").bind("mousedown",function(a){j=b(a.target).closest("th");i=j.prev();f=a.pageX});b(a).find("thead").bind("mouseup mouseleave",function(){h()})}}});
b.tablesorter.addWidget({id:"saveSort",init:function(a,b,c){c.format(a,!0)}, format:function(a,e){var c,d,g=a.config;c={sortList:g.sortList};g.debug&&(d=new Date);b(a).hasClass("hasSaveSort")?a.hasInitialized&&b.tablesorter.storage&&(b.tablesorter.storage(a,"tablesorter-savesort",c),g.debug&&b.tablesorter.benchmark("saveSort widget: Saving last sort: "+g.sortList,d)):(b(a).addClass("hasSaveSort"),c="",b.tablesorter.storage&&(c=(c=b.tablesorter.storage(a,"tablesorter-savesort"))&&c.hasOwnProperty("sortList")&&b.isArray(c.sortList)?c.sortList:"",g.debug&&b.tablesorter.benchmark("saveSort: Last sort loaded: "+ c,d)),e&&c&&0<c.length?g.sortList=c:a.hasInitialized&&c&&0<c.length&&b(a).trigger("sorton",[c]))}})
})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.