diff --git a/README.md b/README.md index 70bc0a5a..26ccb7d9 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,13 @@ tablesorter can successfully parse and sort many types of data including linked View the [complete listing here](https://github.com/Mottie/tablesorter/wiki/Change). +#### Version 2.11.1 (10/11/2013) + +* Fixed an updating bug: + * The pager was not updating properly + * The `updateComplete` event was not firing when not using ajax. + * Thanks @sbine for sharing the fix! + #### Version 2.11 (10/10/2013) **Core** diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index 84efd76f..c3b7ca4b 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -1,6 +1,6 @@ /*! * tablesorter pager plugin - * updated 10/10/2013 + * updated 10/11/2013 */ /*jshint browser:true, jquery:true, unused:false */ /*global toString:true */ @@ -310,6 +310,8 @@ if (p.initialized) { $t.trigger('pagerChange', p); $t.trigger('updateComplete'); + } else { + $t.trigger('update'); } } if (!p.initialized) { diff --git a/addons/pager/jquery.tablesorter.pager.min.js b/addons/pager/jquery.tablesorter.pager.min.js index 893df1b0..f197dce1 100644 --- a/addons/pager/jquery.tablesorter.pager.min.js +++ b/addons/pager/jquery.tablesorter.pager.min.js @@ -1,2 +1,2 @@ -/*! tablesorter pager plugin minified - updated 10/10/2013 */ -;(function(g){var m=g.tablesorter;g.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(b,a){return a},ajaxObject:{dataType:"json"},ajaxProcessing:function(b){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,size:10,savePages:!0,fixedHeight:!1,removeRows:!1,cssFirst:".first",cssPrev:".prev",cssNext:".next",cssLast:".last",cssGoto:".gotoPage",cssPageDisplay:".pagedisplay",cssPageSize:".pagesize",cssErrorRow:"tablesorter-errorRow", cssDisabled:"disabled",totalRows:0,totalPages:0,filteredRows:0,filteredPages:0};var w=this,x=function(b,a){var c=b.cssDisabled,f=!!a,e=Math.min(b.totalPages,b.filteredPages);b.updateArrows&&(b.$container.find(b.cssFirst+","+b.cssPrev)[f||0===b.page?"addClass":"removeClass"](c),b.$container.find(b.cssNext+","+b.cssLast)[f||b.page===e-1?"addClass":"removeClass"](c))},s=function(b,a,c){var f,e,h,d=b.config;f=d.$table.hasClass("hasFilters")&&!a.ajaxUrl;h=(d.widgetOptions&&d.widgetOptions.filter_filteredRow|| "filtered")+","+d.selectorRemove;a.totalPages=Math.ceil(a.totalRows/a.size);a.filteredRows=f?d.$tbodies.eq(0).children("tr:not(."+h+")").length:a.totalRows;a.filteredPages=f?Math.ceil(a.filteredRows/a.size)||1:a.totalPages;if(0<=Math.min(a.totalPages,a.filteredPages)&&(h=a.size*a.page>a.filteredRows,a.startRow=h?1:0===a.filteredRows?0:a.size*a.page+1,a.page=h?0:a.page,a.endRow=Math.min(a.filteredRows,a.totalRows,a.size*(a.page+1)),f=a.$container.find(a.cssPageDisplay),h=(a.ajaxData&&a.ajaxData.hasOwnProperty("output")? a.ajaxData.output||a.output:a.output).replace(/\{page([\-+]\d+)?\}/gi,function(b,c){return a.page+(c?parseInt(c,10):1)}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(b){b=b.replace(/[{}\s]/g,"");var c=b.split(":"),d=a.ajaxData;return 1"+f+"";a.$goto.html(h).val(a.page+1)}x(a);a.initialized&& !1!==c&&(d.$table.trigger("pagerComplete",a),a.savePages&&m.storage&&m.storage(b,"tablesorter-pager",{page:a.page,size:a.size}))},t=function(b,a){var c,f=b.config,e=f.$tbodies.eq(0);a.fixedHeight&&(e.find("tr.pagerSavedHeightSpacer").remove(),c=g.data(b,"pagerSavedHeight"))&&(c-=e.height(),5'))},A=function(b, a){var c=b.config.$tbodies.eq(0);c.find("tr.pagerSavedHeightSpacer").remove();g.data(b,"pagerSavedHeight",c.height());t(b,a);g.data(b,"pagerLastSize",a.size)},u=function(b,a){if(!a.ajaxUrl){var c,f=b.config,e=f.$tbodies.eq(0).children(),h=e.length,d=a.page*a.size,g=d+a.size,n=f.widgetOptions&&f.widgetOptions.filter_filteredRow||"filtered",l=0;for(c=0;c=d&&l'+(0===f.status?"Not connected, verify Network": 404===f.status?"Requested page not found [404]":500===f.status?"Internal Server Error [500]":"parsererror"===e?"Requested JSON parse failed":"timeout"===e?"Time out error":"abort"===e?"Ajax Request aborted":"Uncaught error: "+f.statusText+" ["+f.status+"]")+"").click(function(){g(this).remove()}).appendTo(p.find("thead:first")),k.$tbodies.eq(0).empty();else{"[object Array]"!==toString.call(h)?(c.ajaxData=h,c.totalRows=h.total,l=h.headers,f=h.rows):(f=isNaN(h[0])&&!isNaN(h[1]),e=h[f?1:0], c.totalRows=isNaN(e)?c.totalRows||0:e,f=h[f?0:1]||[],l=h[2]);v=f.length;if(f instanceof jQuery)k.$tbodies.eq(0).empty().append(f);else if(v){if(0";for(e=0;e"+f[h][e]+"";q+=""}k.$tbodies.eq(0).html(q)}l&&l.length===b&&(n=(d=p.hasClass("hasStickyHeaders"))?k.$sticky.children("thead:first").children().children():"",r=p.find("tfoot tr:first").children(),k.$headers.filter("th").each(function(a){var b=g(this),c;b.find("."+m.css.icon).length? (c=b.find("."+m.css.icon).clone(!0),b.find(".tablesorter-header-inner").html(l[a]).append(c),d&&n.length&&(c=n.eq(a).find("."+m.css.icon).clone(!0),n.eq(a).find(".tablesorter-header-inner").html(l[a]).append(c))):(b.find(".tablesorter-header-inner").html(l[a]),d&&n.length&&n.eq(a).find(".tablesorter-header-inner").html(l[a]));r.eq(a).html(l[a])}))}k.showProcessing&&m.isProcessing(a);c.totalPages=Math.ceil(c.totalRows/c.size);s(a,c);t(a,c);c.initialized&&(p.trigger("pagerChange",c),p.trigger("updateComplete"))}c.initialized|| (c.initialized=!0,g(a).trigger("pagerInitialized",c))},H=function(b,a){var c=G(b,a),f=g(document),e=b.config;""!==c&&(e.showProcessing&&m.isProcessing(b,!0),f.bind("ajaxError.pager",function(c,d,e,g){C(null,b,a,d,g);f.unbind("ajaxError.pager")}),a.ajaxObject.url=c,a.ajaxObject.success=function(c){C(c,b,a);f.unbind("ajaxError.pager");"function"===typeof a.oldAjaxSuccess&&a.oldAjaxSuccess(c)},g.ajax(a.ajaxObject))},G=function(b,a){var c=a.ajaxUrl?a.ajaxUrl.replace(/\{page([\-+]\d+)?\}/,function(c,b){return a.page+ (b?parseInt(b,10):0)}).replace(/\{size\}/g,a.size):"",f=b.config.sortList,e=a.currentFilters||[],h=c.match(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/),d=c.match(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/),k=[];h&&(h=h[1],g.each(f,function(a,b){k.push(h+"["+b[0]+"]="+b[1])}),c=c.replace(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/g,k.length?k.join("&"):h),k=[]);d&&(d=d[1],g.each(e,function(a,b){b&&k.push(d+"["+a+"]="+encodeURIComponent(b))}),c=c.replace(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/g,k.length?k.join("&"): d));"function"===typeof a.customAjaxUrl&&(c=a.customAjaxUrl(b,c));return c},y=function(b,a,c){c.isDisabled=!1;var f,e;f=c.page*c.size;var h=f+c.size;if(!(1>a.length)){c.initialized&&g(b).trigger("pagerChange",c);if(c.removeRows){h>a.length&&(h=a.length);m.clearTableBody(b);for(e=m.processTbody(b,b.config.$tbodies.eq(0),!0);f=c.totalPages&&D(b,c);s(b,c);c.isDisabled||t(b,c);g(b).trigger("applyWidgets")}},E=function(b,a){a.ajax?x(a,!0): (a.isDisabled=!0,g.data(b,"pagerLastPage",a.page),g.data(b,"pagerLastSize",a.size),a.page=0,a.size=a.totalRows,a.totalPages=1,g(b).find("tr.pagerSavedHeightSpacer").remove(),y(b,b.config.rowsCopy,a));a.$size.add(a.$goto).each(function(){g(this).addClass(a.cssDisabled)[0].disabled=!0})},k=function(b,a,c){if(!a.isDisabled){var f=Math.min(a.totalPages,a.filteredPages);0>a.page&&(a.page=0);a.page>f-1&&0!==f&&(a.page=f-1);a.ajax?H(b,a):a.ajax||y(b,b.config.rowsCopy,a);g.data(b,"pagerLastPage",a.page); g.data(b,"pagerUpdateTriggered",!0);a.initialized&&!1!==c&&g(b).trigger("pageMoved",a)}},z=function(b,a,c){c.size=a;c.$size.val(a);g.data(b,"pagerLastPage",c.page);g.data(b,"pagerLastSize",c.size);c.totalPages=Math.ceil(c.totalRows/c.size);k(b,c)},I=function(b,a){a.page=0;k(b,a)},D=function(b,a){a.page=Math.min(a.totalPages,a.filteredPages)-1;k(b,a)},J=function(b,a){a.page++;a.page>=Math.min(a.totalPages,a.filteredPages)-1&&(a.page=Math.min(a.totalPages,a.filteredPages)-1);k(b,a)},K=function(b,a){a.page--; 0>=a.page&&(a.page=0);k(b,a)},F=function(b,a,c){var f=a.$size.removeClass(a.cssDisabled).removeAttr("disabled");a.$goto.removeClass(a.cssDisabled).removeAttr("disabled");a.isDisabled=!1;a.page=g.data(b,"pagerLastPage")||a.page||0;a.size=g.data(b,"pagerLastSize")||parseInt(f.find("option[selected]").val(),10)||a.size;f.val(a.size);a.totalPages=Math.ceil(Math.min(a.totalPages,a.filteredPages)/a.size);c&&(g(b).trigger("update"),z(b,a.size,a),B(b,a),t(b,a))};w.appender=function(b,a){var c=b.config.pager; c.ajax||(b.config.rowsCopy=a,c.totalRows=a.length,c.size=g.data(b,"pagerLastSize")||c.size,c.totalPages=Math.ceil(c.totalRows/c.size),y(b,a,c))};w.construct=function(b){return this.each(function(){if(this.config&&this.hasInitialized){var a,c,f,e=this,h=e.config,d=h.pager=g.extend({},g.tablesorterPager.defaults,b),r=h.$table,n=d.$container=g(d.container).addClass("tablesorter-pager").show();d.oldAjaxSuccess=d.oldAjaxSuccess||d.ajaxObject.success;h.appender=w.appender;d.savePages&&m.storage&&(a=m.storage(e, "tablesorter-pager"),d.page=isNaN(a.page)?d.page:a.page,d.size=isNaN(a.size)?d.size:a.size);r.unbind("filterStart.pager filterEnd.pager sortEnd.pager disable.pager enable.pager destroy.pager update.pager pageSize.pager").bind("filterStart.pager",function(a,b){g.data(e,"pagerUpdateTriggered",!1);d.currentFilters=b}).bind("filterEnd.pager sortEnd.pager",function(a){g.data(e,"pagerUpdateTriggered")?g.data(e,"pagerUpdateTriggered",!1):(("filterEnd"===a.type||"sortEnd"===a.type&&h.serverSideSorting)&& k(e,d,!1),s(e,d,!1),t(e,d))}).bind("disable.pager",function(a){a.stopPropagation();E(e,d)}).bind("enable.pager",function(a){a.stopPropagation();F(e,d,!0)}).bind("destroy.pager",function(a){a.stopPropagation();E(e,d);d.$container.hide();e.config.appender=null;g(e).unbind("destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager")}).bind("update.pager",function(a){a.stopPropagation();u(e,d)}).bind("pageSize.pager",function(a,b){a.stopPropagation();z(e,parseInt(b,10)||10,d);u(e,d);s(e, d,!1);d.$size.length&&d.$size.val(d.size)}).bind("pageSet.pager",function(a,b){a.stopPropagation();d.page=(parseInt(b,10)||1)-1;d.$goto.length&&d.$goto.val(d.size);k(e,d);s(e,d,!1)});c=[d.cssFirst,d.cssPrev,d.cssNext,d.cssLast];f=[I,K,J,D];n.find(c.join(",")).unbind("click.pager").bind("click.pager",function(a){var b=g(this),h=c.length;if(!b.hasClass(d.cssDisabled))for(a=0;aa.filteredRows,a.startRow=h?1:0===a.filteredRows?0:a.size*a.page+1,a.page=h?0:a.page,a.endRow=Math.min(a.filteredRows,a.totalRows,a.size*(a.page+1)),f=a.$container.find(a.cssPageDisplay),h=(a.ajaxData&&a.ajaxData.hasOwnProperty("output")? a.ajaxData.output||a.output:a.output).replace(/\{page([\-+]\d+)?\}/gi,function(b,c){return a.page+(c?parseInt(c,10):1)}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(b){b=b.replace(/[{}\s]/g,"");var c=b.split(":"),d=a.ajaxData;return 1"+f+"";a.$goto.html(h).val(a.page+1)}x(a);a.initialized&& !1!==c&&(d.$table.trigger("pagerComplete",a),a.savePages&&m.storage&&m.storage(b,"tablesorter-pager",{page:a.page,size:a.size}))},t=function(b,a){var c,f=b.config,e=f.$tbodies.eq(0);a.fixedHeight&&(e.find("tr.pagerSavedHeightSpacer").remove(),c=g.data(b,"pagerSavedHeight"))&&(c-=e.height(),5'))},A=function(b, a){var c=b.config.$tbodies.eq(0);c.find("tr.pagerSavedHeightSpacer").remove();g.data(b,"pagerSavedHeight",c.height());t(b,a);g.data(b,"pagerLastSize",a.size)},u=function(b,a){if(!a.ajaxUrl){var c,f=b.config,e=f.$tbodies.eq(0).children(),h=e.length,d=a.page*a.size,g=d+a.size,n=f.widgetOptions&&f.widgetOptions.filter_filteredRow||"filtered",l=0;for(c=0;c=d&&l'+(0===f.status?"Not connected, verify Network": 404===f.status?"Requested page not found [404]":500===f.status?"Internal Server Error [500]":"parsererror"===e?"Requested JSON parse failed":"timeout"===e?"Time out error":"abort"===e?"Ajax Request aborted":"Uncaught error: "+f.statusText+" ["+f.status+"]")+"").click(function(){g(this).remove()}).appendTo(p.find("thead:first")),k.$tbodies.eq(0).empty();else{"[object Array]"!==toString.call(h)?(c.ajaxData=h,c.totalRows=h.total,l=h.headers,f=h.rows):(f=isNaN(h[0])&&!isNaN(h[1]),e=h[f?1:0], c.totalRows=isNaN(e)?c.totalRows||0:e,f=h[f?0:1]||[],l=h[2]);v=f.length;if(f instanceof jQuery)k.$tbodies.eq(0).empty().append(f);else if(v){if(0";for(e=0;e"+f[h][e]+"";q+=""}k.$tbodies.eq(0).html(q)}l&&l.length===b&&(n=(d=p.hasClass("hasStickyHeaders"))?k.$sticky.children("thead:first").children().children():"",r=p.find("tfoot tr:first").children(),k.$headers.filter("th").each(function(a){var b=g(this),c;b.find("."+m.css.icon).length? (c=b.find("."+m.css.icon).clone(!0),b.find(".tablesorter-header-inner").html(l[a]).append(c),d&&n.length&&(c=n.eq(a).find("."+m.css.icon).clone(!0),n.eq(a).find(".tablesorter-header-inner").html(l[a]).append(c))):(b.find(".tablesorter-header-inner").html(l[a]),d&&n.length&&n.eq(a).find(".tablesorter-header-inner").html(l[a]));r.eq(a).html(l[a])}))}k.showProcessing&&m.isProcessing(a);c.totalPages=Math.ceil(c.totalRows/c.size);s(a,c);t(a,c);c.initialized?(p.trigger("pagerChange",c),p.trigger("updateComplete")): p.trigger("update")}c.initialized||(c.initialized=!0,g(a).trigger("pagerInitialized",c))},H=function(b,a){var c=G(b,a),f=g(document),e=b.config;""!==c&&(e.showProcessing&&m.isProcessing(b,!0),f.bind("ajaxError.pager",function(c,d,e,g){C(null,b,a,d,g);f.unbind("ajaxError.pager")}),a.ajaxObject.url=c,a.ajaxObject.success=function(c){C(c,b,a);f.unbind("ajaxError.pager");"function"===typeof a.oldAjaxSuccess&&a.oldAjaxSuccess(c)},g.ajax(a.ajaxObject))},G=function(b,a){var c=a.ajaxUrl?a.ajaxUrl.replace(/\{page([\-+]\d+)?\}/, function(c,b){return a.page+(b?parseInt(b,10):0)}).replace(/\{size\}/g,a.size):"",f=b.config.sortList,e=a.currentFilters||[],h=c.match(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/),d=c.match(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/),k=[];h&&(h=h[1],g.each(f,function(a,b){k.push(h+"["+b[0]+"]="+b[1])}),c=c.replace(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/g,k.length?k.join("&"):h),k=[]);d&&(d=d[1],g.each(e,function(a,b){b&&k.push(d+"["+a+"]="+encodeURIComponent(b))}),c=c.replace(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/g, k.length?k.join("&"):d));"function"===typeof a.customAjaxUrl&&(c=a.customAjaxUrl(b,c));return c},y=function(b,a,c){c.isDisabled=!1;var f,e;f=c.page*c.size;var h=f+c.size;if(!(1>a.length)){c.initialized&&g(b).trigger("pagerChange",c);if(c.removeRows){h>a.length&&(h=a.length);m.clearTableBody(b);for(e=m.processTbody(b,b.config.$tbodies.eq(0),!0);f=c.totalPages&&D(b,c);s(b,c);c.isDisabled||t(b,c);g(b).trigger("applyWidgets")}},E=function(b, a){a.ajax?x(a,!0):(a.isDisabled=!0,g.data(b,"pagerLastPage",a.page),g.data(b,"pagerLastSize",a.size),a.page=0,a.size=a.totalRows,a.totalPages=1,g(b).find("tr.pagerSavedHeightSpacer").remove(),y(b,b.config.rowsCopy,a));a.$size.add(a.$goto).each(function(){g(this).addClass(a.cssDisabled)[0].disabled=!0})},k=function(b,a,c){if(!a.isDisabled){var f=Math.min(a.totalPages,a.filteredPages);0>a.page&&(a.page=0);a.page>f-1&&0!==f&&(a.page=f-1);a.ajax?H(b,a):a.ajax||y(b,b.config.rowsCopy,a);g.data(b,"pagerLastPage", a.page);g.data(b,"pagerUpdateTriggered",!0);a.initialized&&!1!==c&&g(b).trigger("pageMoved",a)}},z=function(b,a,c){c.size=a;c.$size.val(a);g.data(b,"pagerLastPage",c.page);g.data(b,"pagerLastSize",c.size);c.totalPages=Math.ceil(c.totalRows/c.size);k(b,c)},I=function(b,a){a.page=0;k(b,a)},D=function(b,a){a.page=Math.min(a.totalPages,a.filteredPages)-1;k(b,a)},J=function(b,a){a.page++;a.page>=Math.min(a.totalPages,a.filteredPages)-1&&(a.page=Math.min(a.totalPages,a.filteredPages)-1);k(b,a)},K=function(b, a){a.page--;0>=a.page&&(a.page=0);k(b,a)},F=function(b,a,c){var f=a.$size.removeClass(a.cssDisabled).removeAttr("disabled");a.$goto.removeClass(a.cssDisabled).removeAttr("disabled");a.isDisabled=!1;a.page=g.data(b,"pagerLastPage")||a.page||0;a.size=g.data(b,"pagerLastSize")||parseInt(f.find("option[selected]").val(),10)||a.size;f.val(a.size);a.totalPages=Math.ceil(Math.min(a.totalPages,a.filteredPages)/a.size);c&&(g(b).trigger("update"),z(b,a.size,a),B(b,a),t(b,a))};w.appender=function(b,a){var c= b.config.pager;c.ajax||(b.config.rowsCopy=a,c.totalRows=a.length,c.size=g.data(b,"pagerLastSize")||c.size,c.totalPages=Math.ceil(c.totalRows/c.size),y(b,a,c))};w.construct=function(b){return this.each(function(){if(this.config&&this.hasInitialized){var a,c,f,e=this,h=e.config,d=h.pager=g.extend({},g.tablesorterPager.defaults,b),r=h.$table,n=d.$container=g(d.container).addClass("tablesorter-pager").show();d.oldAjaxSuccess=d.oldAjaxSuccess||d.ajaxObject.success;h.appender=w.appender;d.savePages&&m.storage&& (a=m.storage(e,"tablesorter-pager"),d.page=isNaN(a.page)?d.page:a.page,d.size=isNaN(a.size)?d.size:a.size);r.unbind("filterStart.pager filterEnd.pager sortEnd.pager disable.pager enable.pager destroy.pager update.pager pageSize.pager").bind("filterStart.pager",function(a,b){g.data(e,"pagerUpdateTriggered",!1);d.currentFilters=b}).bind("filterEnd.pager sortEnd.pager",function(a){g.data(e,"pagerUpdateTriggered")?g.data(e,"pagerUpdateTriggered",!1):(("filterEnd"===a.type||"sortEnd"===a.type&&h.serverSideSorting)&& k(e,d,!1),s(e,d,!1),t(e,d))}).bind("disable.pager",function(a){a.stopPropagation();E(e,d)}).bind("enable.pager",function(a){a.stopPropagation();F(e,d,!0)}).bind("destroy.pager",function(a){a.stopPropagation();E(e,d);d.$container.hide();e.config.appender=null;g(e).unbind("destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager")}).bind("update.pager",function(a){a.stopPropagation();u(e,d)}).bind("pageSize.pager",function(a,b){a.stopPropagation();z(e,parseInt(b,10)||10,d);u(e,d);s(e, d,!1);d.$size.length&&d.$size.val(d.size)}).bind("pageSet.pager",function(a,b){a.stopPropagation();d.page=(parseInt(b,10)||1)-1;d.$goto.length&&d.$goto.val(d.size);k(e,d);s(e,d,!1)});c=[d.cssFirst,d.cssPrev,d.cssNext,d.cssLast];f=[I,K,J,D];n.find(c.join(",")).unbind("click.pager").bind("click.pager",function(a){var b=g(this),h=c.length;if(!b.hasClass(d.cssDisabled))for(a=0;a=1.2.6" } diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index 030b135a..3acb332e 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -1,5 +1,5 @@ -/*! -* TableSorter 2.11.0 - Client-side table sorting with ease! +/**! +* TableSorter 2.11.1 - Client-side table sorting with ease! * @requires jQuery v1.2.6+ * * Copyright (c) 2007 Christian Bach @@ -24,7 +24,7 @@ var ts = this; - ts.version = "2.11.0"; + ts.version = "2.11.1"; ts.parsers = []; ts.widgets = []; @@ -343,6 +343,7 @@ if (!init) { ts.applyWidget(table); } // trigger sortend $(table).trigger("sortEnd", table); + $(table).trigger("updateComplete", table); } // computeTableHeaderCellIndexes from: diff --git a/js/jquery.tablesorter.min.js b/js/jquery.tablesorter.min.js index 3029ee6c..3227eb4d 100644 --- a/js/jquery.tablesorter.min.js +++ b/js/jquery.tablesorter.min.js @@ -2,4 +2,4 @@ * TableSorter 2.11.0 min - Client-side table sorting with ease! * Copyright (c) 2007 Christian Bach */ -!(function(h){h.extend({tablesorter:new function(){function c(a){"undefined"!==typeof console&&"undefined"!==typeof console.log?console.log(a):alert(a)}function n(a,b){c(a+" ("+((new Date).getTime()-b.getTime())+"ms)")}function m(a){for(var b in a)return!1;return!0}function p(a,b,d){if(!b)return"";var e=a.config,f=e.textExtraction,g="",g="simple"===f?e.supportsTextContent?b.textContent:h(b).text():"function"===typeof f?f(b,a,d):"object"===typeof f&&f.hasOwnProperty(d)?f[d](b,a,d):e.supportsTextContent? b.textContent:h(b).text();return h.trim(g)}function r(a){var b=a.config,d=b.$tbodies=b.$table.children("tbody:not(."+b.cssInfoBlock+")"),e,w,g,l,q,h,k="";if(0===d.length)return b.debug?c("*Empty table!* Not building a parser cache"):"";d=d[0].rows;if(d[0])for(e=[],w=d[0].cells.length,g=0;g':"";k.$headers=h(a).find(k.selectorHeaders).each(function(a){e=h(this);d=k.headers[a];k.headerContent[a]=this.innerHTML;l=k.headerTemplate.replace(/\{content\}/g,this.innerHTML).replace(/\{icon\}/g,g);k.onRenderTemplate&&(w=k.onRenderTemplate.apply(e,[a,l]))&&"string"===typeof w&&(l=w);this.innerHTML='
'+l+"
";k.onRenderHeader&&k.onRenderHeader.apply(e,[a]); this.column=b[this.parentNode.rowIndex+"-"+this.cellIndex];var c=f.getData(e,d,"sortInitialOrder")||k.sortInitialOrder;this.order=/^d/i.test(c)||1===c?[1,0,2]:[0,1,2];this.count=-1;this.lockedOrder=!1;q=f.getData(e,d,"lockedOrder")||!1;"undefined"!==typeof q&&!1!==q&&(this.order=this.lockedOrder=/^d/i.test(q)||1===q?[1,1,1]:[0,0,0]);e.addClass(f.css.header+" "+k.cssHeader);k.headerList[a]=this;e.parent().addClass(f.css.headerRow+" "+k.cssHeaderRow);e.attr("tabindex",0)});B(a);k.debug&&(n("Built headers:", s),c(k.$headers))}function E(a,b,d){var e=a.config;e.$table.find(e.selectorRemove).remove();r(a);u(a);F(e.$table,b,d)}function B(a){var b,d=a.config;d.$headers.each(function(a,c){b="false"===f.getData(c,d.headers[a],"sorter");c.sortDisabled=b;h(c)[b?"addClass":"removeClass"]("sorter-false")})}function G(a){var b,d,e,c=a.config,g=c.sortList,l=[f.css.sortAsc+" "+c.cssAsc,f.css.sortDesc+" "+c.cssDesc],q=h(a).find("tfoot tr").children().removeClass(l.join(" "));c.$headers.removeClass(l.join(" "));e=g.length; for(b=0;b"),d=h(a).width();h(a.tBodies[0]).find("tr:first").children("td:visible").each(function(){b.append(h("").css("width",parseInt(1E3* (h(this).width()/d),10)/10+"%"))});h(a).prepend(b)}}function L(a,b){var d,e,c,g=a.config,f=b||g.sortList;g.sortList=[];h.each(f,function(a,b){d=[parseInt(b[0],10),parseInt(b[1],10)];if(c=g.headerList[d[0]])g.sortList.push(d),e=h.inArray(d[1],c.order),c.count=0<=e?e:d[1]%(g.sortReset?3:2)})}function M(a,b,d){var e,c,g=a.config,l=!d[g.sortMultiSortKey],q=h(a);q.trigger("sortStart",a);b.count=d[g.sortResetKey]?2:(b.count+1)%(g.sortReset?3:2);g.sortRestart&&(c=b,g.$headers.each(function(){this===c||!l&& h(this).is("."+f.css.sortDesc+",."+f.css.sortAsc)||(this.count=-1)}));c=b.column;if(l){g.sortList=[];if(null!==g.sortForce)for(e=g.sortForce,d=0;de&&(g.sortList.push([c,e]),1e&&(g.sortList.push([c,e]),1 thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};f.css={table:"tablesorter", childRow:"tablesorter-childRow",header:"tablesorter-header",headerRow:"tablesorter-headerRow",icon:"tablesorter-icon",info:"tablesorter-infoOnly",processing:"tablesorter-processing",sortAsc:"tablesorter-headerAsc",sortDesc:"tablesorter-headerDesc"};f.log=c;f.benchmark=n;f.construct=function(a){return this.each(function(){var b=h.extend(!0,{},f.defaults,a);!this.hasInitialized&&f.buildTable&&"TABLE"!==this.tagName&&f.buildTable(this,b);f.setup(this,b)})};f.setup=function(a,b){if(!a||!a.tHead||0=== a.tBodies.length||!0===a.hasInitialized)return b.debug?c("stopping initialization! No table, thead, tbody or tablesorter has already been initialized"):"";var d="",e=h(a),w=h.metadata;a.hasInitialized=!1;a.isProcessing=!0;a.config=b;h.data(a,"tablesorter",b);b.debug&&h.data(a,"startoveralltimer",new Date);b.supportsTextContent="x"===h("x")[0].textContent;b.supportsDataObject=function(a){a[0]=parseInt(a[0],10);return 1'),d=h.fn.detach?b.detach():b.remove();d=h(a).find("span.tablesorter-savemyplace"); b.insertAfter(d);d.remove();a.isProcessing=!1};f.clearTableBody=function(a){h(a)[0].config.$tbodies.empty()};f.restoreHeaders=function(a){var b=a.config;b.$table.find(b.selectorHeaders).each(function(a){h(this).find(".tablesorter-header-inner").length&&h(this).html(b.headerContent[a])})};f.destroy=function(a,b,d){a=h(a)[0];if(a.hasInitialized){f.refreshWidgets(a,!0,!0);var e=h(a),c=a.config,g=e.find("thead:first"),l=g.find("tr."+f.css.headerRow).removeClass(f.css.headerRow+" "+c.cssHeaderRow),n=e.find("tfoot:first > tr").children("th, td"); g.find("tr").not(l).remove();e.removeData("tablesorter").unbind("sortReset update updateAll updateRows updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress sortBegin sortEnd ".split(" ").join(".tablesorter "));c.$headers.add(n).removeClass([f.css.header,c.cssHeader,c.cssAsc,c.cssDesc,f.css.sortAsc,f.css.sortDesc].join(" ")).removeAttr("data-column");l.find(c.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter keypress.tablesorter"); f.restoreHeaders(a);!1!==b&&e.removeClass(f.css.table+" "+c.tableClass+" tablesorter-"+c.theme);a.hasInitialized=!1;"function"===typeof d&&d(a)}};f.regex={chunk:/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,hex:/^0x[0-9a-f]+$/i};f.sortText=function(a,b,d,e){if(b===d)return 0;var c=a.config,g=c.string[c.empties[e]||c.emptyTo],h=f.regex;if(""===b&&0!==g)return"boolean"===typeof g?g?-1:1:-g||-1;if(""===d&&0!==g)return"boolean"===typeof g?g?1:-1:g||1;if("function"===typeof c.textSorter)return c.textSorter(b, d,a,e);if(e=parseInt(d.match(h.hex),16)){a=parseInt(b.match(h.hex),16);if(ae)return 1}b=b.replace(h.chunk,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");d=d.replace(h.chunk,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");c=Math.max(b.length,d.length);for(e=0;ea)return 1}return 0}; f.sortTextDesc=function(a,b,d,e){if(b===d)return 0;var c=a.config,g=c.string[c.empties[e]||c.emptyTo];return""===b&&0!==g?"boolean"===typeof g?g?-1:1:g||1:""===d&&0!==g?"boolean"===typeof g?g?1:-1:-g||-1:"function"===typeof c.textSorter?c.textSorter(d,b,a,e):f.sortText(a,d,b)};f.getTextValue=function(a,b,d){if(b){var e=a?a.length:0,c=b+d;for(b=0;bh.inArray(l[e].id,g))&&(n.debug&&c("Refeshing widgets: Removing "+l[e].id),l[e].hasOwnProperty("remove")&&(l[e].remove(a,n,n.widgetOptions),n.widgetInit[l[e].id]=!1));!0!==d&&f.applyWidget(a,b)};f.getData= function(a,b,d){var c="";a=h(a);var f,g;if(!a.length)return"";f=h.metadata?a.metadata():!1;g=" "+(a.attr("class")||"");"undefined"!==typeof a.data(d)||"undefined"!==typeof a.data(d.toLowerCase())?c+=a.data(d)||a.data(d.toLowerCase()):f&&"undefined"!==typeof f[d]?c+=f[d]:b&&"undefined"!==typeof b[d]?c+=b[d]:" "!==g&&g.match(" "+d+"-")&&(c=g.match(RegExp("\\s"+d+"-([\\w-]+)"))[1]||"");return h.trim(c)};f.formatFloat=function(a,b){if("string"!==typeof a||""===a)return a;var c;a=(b&&b.config?!1!==b.config.usNumberFormat: "undefined"!==typeof b?b:1)?a.replace(/,/g,""):a.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(a)&&(a=a.replace(/^\s*\(/,"-").replace(/\)/,""));c=parseFloat(a);return isNaN(c)?h.trim(a):c};f.isDigit=function(a){return isNaN(a)?/^[\-+(]?\d+[)]?$/.test(a.toString().replace(/[,.'"\s]/g,"")):!0}}});var p=h.tablesorter;h.fn.extend({tablesorter:p.construct});p.addParser({id:"text",is:function(){return!0},format:function(c,n){var m=n.config;c&&(c=h.trim(m.ignoreCase?c.toLocaleLowerCase(): c),c=m.sortLocaleCompare?p.replaceAccents(c):c);return c},type:"text"});p.addParser({id:"digit",is:function(c){return p.isDigit(c)},format:function(c,n){var m=p.formatFloat((c||"").replace(/[^\w,. \-()]/g,""),n);return c&&"number"===typeof m?m:c?h.trim(c&&n.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"});p.addParser({id:"currency",is:function(c){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test((c||"").replace(/[,. ]/g,""))},format:function(c, n){var m=p.formatFloat((c||"").replace(/[^\w,. \-()]/g,""),n);return c&&"number"===typeof m?m:c?h.trim(c&&n.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"});p.addParser({id:"ipAddress",is:function(c){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(c)},format:function(c,h){var m,t=c?c.split("."):"",r="",u=t.length;for(m=0;mc.length},format:function(c,h){return c?p.formatFloat(c.replace(/%/g,""),h):c},type:"numeric"});p.addParser({id:"usLongDate", is:function(c){return/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i.test(c)||/^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i.test(c)},format:function(c,h){return c?p.formatFloat((new Date(c.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",h):c},type:"numeric"});p.addParser({id:"shortDate",is:function(c){return/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/.test((c||"").replace(/\s+/g," ").replace(/[\-.,]/g,"/"))},format:function(c,h,m,t){if(c){m=h.config; var r=m.headerList[t];t=r.dateFormat||p.getData(r,m.headers[t],"dateFormat")||m.dateFormat;c=c.replace(/\s+/g," ").replace(/[\-.,]/g,"/");"mmddyyyy"===t?c=c.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$1/$2"):"ddmmyyyy"===t?c=c.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$2/$1"):"yyyymmdd"===t&&(c=c.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3"))}return c?p.formatFloat((new Date(c)).getTime()||"",h):c},type:"numeric"});p.addParser({id:"time",is:function(c){return/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i.test(c)}, format:function(c,h){return c?p.formatFloat((new Date("2000/01/01 "+c.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",h):c},type:"numeric"});p.addParser({id:"metadata",is:function(){return!1},format:function(c,n,m){c=n.config;c=c.parserMetadataName?c.parserMetadataName:"sortValue";return h(m).metadata()[c]},type:"numeric"});p.addWidget({id:"zebra",priority:90,format:function(c,n,m){var t,r,u,y,D,A,E=RegExp(n.cssChildRow,"i"),B=n.$tbodies;n.debug&&(D=new Date);for(c=0;c':"";k.$headers=h(a).find(k.selectorHeaders).each(function(a){e=h(this);d=k.headers[a];k.headerContent[a]=this.innerHTML;l=k.headerTemplate.replace(/\{content\}/g,this.innerHTML).replace(/\{icon\}/g,g);k.onRenderTemplate&&(w=k.onRenderTemplate.apply(e,[a,l]))&&"string"===typeof w&&(l=w);this.innerHTML='
'+l+"
";k.onRenderHeader&&k.onRenderHeader.apply(e,[a]); this.column=b[this.parentNode.rowIndex+"-"+this.cellIndex];var c=f.getData(e,d,"sortInitialOrder")||k.sortInitialOrder;this.order=/^d/i.test(c)||1===c?[1,0,2]:[0,1,2];this.count=-1;this.lockedOrder=!1;q=f.getData(e,d,"lockedOrder")||!1;"undefined"!==typeof q&&!1!==q&&(this.order=this.lockedOrder=/^d/i.test(q)||1===q?[1,1,1]:[0,0,0]);e.addClass(f.css.header+" "+k.cssHeader);k.headerList[a]=this;e.parent().addClass(f.css.headerRow+" "+k.cssHeaderRow);e.attr("tabindex",0)});B(a);k.debug&&(n("Built headers:", s),c(k.$headers))}function E(a,b,d){var e=a.config;e.$table.find(e.selectorRemove).remove();r(a);u(a);F(e.$table,b,d)}function B(a){var b,d=a.config;d.$headers.each(function(a,c){b="false"===f.getData(c,d.headers[a],"sorter");c.sortDisabled=b;h(c)[b?"addClass":"removeClass"]("sorter-false")})}function G(a){var b,d,e,c=a.config,g=c.sortList,l=[f.css.sortAsc+" "+c.cssAsc,f.css.sortDesc+" "+c.cssDesc],q=h(a).find("tfoot tr").children().removeClass(l.join(" "));c.$headers.removeClass(l.join(" "));e=g.length; for(b=0;b"),d=h(a).width();h(a.tBodies[0]).find("tr:first").children("td:visible").each(function(){b.append(h("").css("width",parseInt(1E3* (h(this).width()/d),10)/10+"%"))});h(a).prepend(b)}}function L(a,b){var d,e,c,g=a.config,f=b||g.sortList;g.sortList=[];h.each(f,function(a,b){d=[parseInt(b[0],10),parseInt(b[1],10)];if(c=g.headerList[d[0]])g.sortList.push(d),e=h.inArray(d[1],c.order),c.count=0<=e?e:d[1]%(g.sortReset?3:2)})}function M(a,b,d){var e,c,g=a.config,l=!d[g.sortMultiSortKey],q=h(a);q.trigger("sortStart",a);b.count=d[g.sortResetKey]?2:(b.count+1)%(g.sortReset?3:2);g.sortRestart&&(c=b,g.$headers.each(function(){this===c||!l&& h(this).is("."+f.css.sortDesc+",."+f.css.sortAsc)||(this.count=-1)}));c=b.column;if(l){g.sortList=[];if(null!==g.sortForce)for(e=g.sortForce,d=0;de&&(g.sortList.push([c,e]),1e&&(g.sortList.push([c,e]),1 thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};f.css={table:"tablesorter", childRow:"tablesorter-childRow",header:"tablesorter-header",headerRow:"tablesorter-headerRow",icon:"tablesorter-icon",info:"tablesorter-infoOnly",processing:"tablesorter-processing",sortAsc:"tablesorter-headerAsc",sortDesc:"tablesorter-headerDesc"};f.log=c;f.benchmark=n;f.construct=function(a){return this.each(function(){var b=h.extend(!0,{},f.defaults,a);!this.hasInitialized&&f.buildTable&&"TABLE"!==this.tagName&&f.buildTable(this,b);f.setup(this,b)})};f.setup=function(a,b){if(!a||!a.tHead||0=== a.tBodies.length||!0===a.hasInitialized)return b.debug?c("stopping initialization! No table, thead, tbody or tablesorter has already been initialized"):"";var d="",e=h(a),w=h.metadata;a.hasInitialized=!1;a.isProcessing=!0;a.config=b;h.data(a,"tablesorter",b);b.debug&&h.data(a,"startoveralltimer",new Date);b.supportsTextContent="x"===h("x")[0].textContent;b.supportsDataObject=function(a){a[0]=parseInt(a[0],10);return 1'),d=h.fn.detach?b.detach():b.remove();d=h(a).find("span.tablesorter-savemyplace"); b.insertAfter(d);d.remove();a.isProcessing=!1};f.clearTableBody=function(a){h(a)[0].config.$tbodies.empty()};f.restoreHeaders=function(a){var b=a.config;b.$table.find(b.selectorHeaders).each(function(a){h(this).find(".tablesorter-header-inner").length&&h(this).html(b.headerContent[a])})};f.destroy=function(a,b,d){a=h(a)[0];if(a.hasInitialized){f.refreshWidgets(a,!0,!0);var e=h(a),c=a.config,g=e.find("thead:first"),l=g.find("tr."+f.css.headerRow).removeClass(f.css.headerRow+" "+c.cssHeaderRow),n=e.find("tfoot:first > tr").children("th, td"); g.find("tr").not(l).remove();e.removeData("tablesorter").unbind("sortReset update updateAll updateRows updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress sortBegin sortEnd ".split(" ").join(".tablesorter "));c.$headers.add(n).removeClass([f.css.header,c.cssHeader,c.cssAsc,c.cssDesc,f.css.sortAsc,f.css.sortDesc].join(" ")).removeAttr("data-column");l.find(c.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter keypress.tablesorter"); f.restoreHeaders(a);!1!==b&&e.removeClass(f.css.table+" "+c.tableClass+" tablesorter-"+c.theme);a.hasInitialized=!1;"function"===typeof d&&d(a)}};f.regex={chunk:/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,hex:/^0x[0-9a-f]+$/i};f.sortText=function(a,b,d,e){if(b===d)return 0;var c=a.config,g=c.string[c.empties[e]||c.emptyTo],h=f.regex;if(""===b&&0!==g)return"boolean"===typeof g?g?-1:1:-g||-1;if(""===d&&0!==g)return"boolean"===typeof g?g?1:-1:g||1;if("function"===typeof c.textSorter)return c.textSorter(b, d,a,e);if(e=parseInt(d.match(h.hex),16)){a=parseInt(b.match(h.hex),16);if(ae)return 1}b=b.replace(h.chunk,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");d=d.replace(h.chunk,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");c=Math.max(b.length,d.length);for(e=0;ea)return 1}return 0}; f.sortTextDesc=function(a,b,d,e){if(b===d)return 0;var c=a.config,g=c.string[c.empties[e]||c.emptyTo];return""===b&&0!==g?"boolean"===typeof g?g?-1:1:g||1:""===d&&0!==g?"boolean"===typeof g?g?1:-1:-g||-1:"function"===typeof c.textSorter?c.textSorter(d,b,a,e):f.sortText(a,d,b)};f.getTextValue=function(a,b,d){if(b){var e=a?a.length:0,c=b+d;for(b=0;bh.inArray(l[e].id,g))&&(n.debug&&c("Refeshing widgets: Removing "+l[e].id),l[e].hasOwnProperty("remove")&&(l[e].remove(a,n,n.widgetOptions),n.widgetInit[l[e].id]=!1));!0!==d&&f.applyWidget(a,b)};f.getData= function(a,b,d){var c="";a=h(a);var f,g;if(!a.length)return"";f=h.metadata?a.metadata():!1;g=" "+(a.attr("class")||"");"undefined"!==typeof a.data(d)||"undefined"!==typeof a.data(d.toLowerCase())?c+=a.data(d)||a.data(d.toLowerCase()):f&&"undefined"!==typeof f[d]?c+=f[d]:b&&"undefined"!==typeof b[d]?c+=b[d]:" "!==g&&g.match(" "+d+"-")&&(c=g.match(RegExp("\\s"+d+"-([\\w-]+)"))[1]||"");return h.trim(c)};f.formatFloat=function(a,b){if("string"!==typeof a||""===a)return a;var c;a=(b&&b.config?!1!==b.config.usNumberFormat: "undefined"!==typeof b?b:1)?a.replace(/,/g,""):a.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(a)&&(a=a.replace(/^\s*\(/,"-").replace(/\)/,""));c=parseFloat(a);return isNaN(c)?h.trim(a):c};f.isDigit=function(a){return isNaN(a)?/^[\-+(]?\d+[)]?$/.test(a.toString().replace(/[,.'"\s]/g,"")):!0}}});var p=h.tablesorter;h.fn.extend({tablesorter:p.construct});p.addParser({id:"text",is:function(){return!0},format:function(c,n){var m=n.config;c&&(c=h.trim(m.ignoreCase?c.toLocaleLowerCase(): c),c=m.sortLocaleCompare?p.replaceAccents(c):c);return c},type:"text"});p.addParser({id:"digit",is:function(c){return p.isDigit(c)},format:function(c,n){var m=p.formatFloat((c||"").replace(/[^\w,. \-()]/g,""),n);return c&&"number"===typeof m?m:c?h.trim(c&&n.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"});p.addParser({id:"currency",is:function(c){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test((c||"").replace(/[,. ]/g,""))},format:function(c, n){var m=p.formatFloat((c||"").replace(/[^\w,. \-()]/g,""),n);return c&&"number"===typeof m?m:c?h.trim(c&&n.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"});p.addParser({id:"ipAddress",is:function(c){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(c)},format:function(c,h){var m,t=c?c.split("."):"",r="",u=t.length;for(m=0;mc.length},format:function(c,h){return c?p.formatFloat(c.replace(/%/g,""),h):c},type:"numeric"});p.addParser({id:"usLongDate", is:function(c){return/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i.test(c)||/^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i.test(c)},format:function(c,h){return c?p.formatFloat((new Date(c.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",h):c},type:"numeric"});p.addParser({id:"shortDate",is:function(c){return/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/.test((c||"").replace(/\s+/g," ").replace(/[\-.,]/g,"/"))},format:function(c,h,m,t){if(c){m=h.config; var r=m.headerList[t];t=r.dateFormat||p.getData(r,m.headers[t],"dateFormat")||m.dateFormat;c=c.replace(/\s+/g," ").replace(/[\-.,]/g,"/");"mmddyyyy"===t?c=c.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$1/$2"):"ddmmyyyy"===t?c=c.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$2/$1"):"yyyymmdd"===t&&(c=c.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3"))}return c?p.formatFloat((new Date(c)).getTime()||"",h):c},type:"numeric"});p.addParser({id:"time",is:function(c){return/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i.test(c)}, format:function(c,h){return c?p.formatFloat((new Date("2000/01/01 "+c.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",h):c},type:"numeric"});p.addParser({id:"metadata",is:function(){return!1},format:function(c,n,m){c=n.config;c=c.parserMetadataName?c.parserMetadataName:"sortValue";return h(m).metadata()[c]},type:"numeric"});p.addWidget({id:"zebra",priority:90,format:function(c,n,m){var t,r,u,y,D,A,E=RegExp(n.cssChildRow,"i"),B=n.$tbodies;n.debug&&(D=new Date);for(c=0;c