From 888f518b293b172af664495fffd9dda1a232b930 Mon Sep 17 00:00:00 2001 From: Mottie Date: Wed, 11 Mar 2015 19:20:51 -0500 Subject: [PATCH] Pager: don't recalculate total rows/pages if using ajax --- addons/pager/jquery.tablesorter.pager.js | 4 ++-- dist/js/extras/jquery.tablesorter.pager.min.js | 2 +- dist/js/widgets/widget-pager.min.js | 2 +- js/widgets/widget-pager.js | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index 04089575..5b2040f1 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -705,7 +705,6 @@ pg = Math.min( p.totalPages, p.filteredPages ); if ( p.page < 0 ) { p.page = 0; } if ( p.page > ( pg - 1 ) && pg !== 0 ) { p.page = pg - 1; } - // fixes issue where one currentFilter is [] and the other is ['','',''], // making the next if comparison think the filters are different (joined by commas). Fixes #202. l.currentFilters = (l.currentFilters || []).join('') === '' ? [] : l.currentFilters; @@ -911,7 +910,8 @@ .bind('updateComplete.pager', function(e, table, triggered){ e.stopPropagation(); // table can be unintentionally undefined in tablesorter v2.17.7 and earlier - if ( !table || triggered ) { return; } + // don't recalculate total rows/pages if using ajax + if ( !table || triggered || p.ajax ) { return; } var $rows = c.$tbodies.eq(0).children('tr').not(c.selectorRemove); p.totalRows = $rows.length - ( p.countChildRows ? 0 : $rows.filter('.' + c.cssChildRow).length ); p.totalPages = Math.ceil( p.totalRows / p.size ); diff --git a/dist/js/extras/jquery.tablesorter.pager.min.js b/dist/js/extras/jquery.tablesorter.pager.min.js index ff196676..200b7437 100644 --- a/dist/js/extras/jquery.tablesorter.pager.min.js +++ b/dist/js/extras/jquery.tablesorter.pager.min.js @@ -2,5 +2,5 @@ * tablesorter (FORK) pager plugin * updated 3/5/2015 (v2.21.0) */ -!function(a){"use strict";var b=a.tablesorter;a.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(a,b){return b},ajaxObject:{dataType:"json"},processAjaxOnInit:!0,ajaxProcessing:function(){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,pageReset:0,size:10,maxOptionSize:20,savePages:!0,storageKey:"tablesorter-pager",fixedHeight:!1,countChildRows:!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,ajaxCounter:0,currentFilters:[],startRow:0,endRow:0,$size:null,last:{}};var c="filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet pageAndSize pagerUpdate ",d=this,e=function(a,b){var c="addClass",d="removeClass",e=a.cssDisabled,f=!!b,g=f||0===a.page,h=Math.min(a.totalPages,a.filteredPages),i=f||a.page===h-1||0===h;a.updateArrows&&(a.$container.find(a.cssFirst+","+a.cssPrev)[g?c:d](e).attr("aria-disabled",g),a.$container.find(a.cssNext+","+a.cssLast)[i?c:d](e).attr("aria-disabled",i))},f=function(b,c){var d,e,f,g=b.config,h=g.$table.hasClass("hasFilters");if(h&&!c.ajaxUrl)if(a.isEmptyObject(g.cache))c.filteredRows=c.totalRows=g.$tbodies.eq(0).children("tr").not(c.countChildRows?"":"."+g.cssChildRow).length;else for(c.filteredRows=0,d=g.cache[0].normalized,f=d.length,e=0;f>e;e++)c.filteredRows+=c.regexRows.test(d[e][g.columns].$row[0].className)?0:1;else h||(c.filteredRows=c.totalRows)},g=function(c,d,g){if(!d.initializing){var j,k,l,m,n,o,p=c.config,q=d.size||d.settings.size||10;if(d.countChildRows&&k.push(p.cssChildRow),d.totalPages=Math.ceil(d.totalRows/q),p.totalRows=d.totalRows,f(c,d),p.filteredRows=d.filteredRows,d.filteredPages=Math.ceil(d.filteredRows/q)||0,Math.min(d.totalPages,d.filteredPages)>=0){if(k=d.size*d.page>d.filteredRows&&g,d.page=k?d.pageReset||0:d.page,d.startRow=k?d.size*d.page+1:0===d.filteredRows?0:d.size*d.page+1,d.endRow=Math.min(d.filteredRows,d.totalRows,d.size*(d.page+1)),l=d.$container.find(d.cssPageDisplay),j=(d.ajaxData&&d.ajaxData.output?d.ajaxData.output||d.output:d.output).replace(/\{page([\-+]\d+)?\}/gi,function(a,b){return d.totalPages?d.page+(b?parseInt(b,10):1):0}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(a){var b,c,e=a.replace(/[{}\s]/g,""),f=e.split(":"),g=d.ajaxData,h=/(rows?|pages?)$/i.test(e)?0:"";return/(startRow|page)/.test(f[0])&&"input"===f[1]?(b=(""+("page"===f[0]?d.totalPages:d.totalRows)).length,c="page"===f[0]?d.page+1:d.startRow,''):f.length>1&&g&&g[f[0]]?g[f[0]][f[1]]:d[e]||(g?g[e]:h)||h}),d.$goto.length){for(k="",o=h(d),n=o.length,m=0;n>m;m++)k+='";d.$goto.html(k).val(d.page+1)}l.length&&(l["INPUT"===l[0].tagName?"val":"html"](j),l.find(".ts-startRow, .ts-page").unbind("change.pager").bind("change.pager",function(){var b=a(this).val(),c=a(this).hasClass("ts-startRow")?Math.floor(b/d.size)+1:b;p.$table.trigger("pageSet.pager",[c])}))}e(d),i(c,d),d.initialized&&g!==!1&&(p.debug&&b.log("Pager: Triggering pagerComplete"),p.$table.trigger("pagerComplete",d),d.savePages&&b.storage&&b.storage(c,d.storageKey,{page:d.page,size:d.size}))}},h=function(b){var c,d,e,f,g,h,i=Math.min(b.totalPages,b.filteredPages)||1,j=5*Math.ceil(i/b.maxOptionSize/5),k=i>b.maxOptionSize,l=b.page+1,m=j,n=i-j,o=[1],p=k?j:1;for(c=p;i>=c;)o.push(c),c+=k?j:1;if(o.push(i),k){for(e=[],d=Math.max(Math.floor(b.maxOptionSize/j)-1,5),m=l-d,1>m&&(m=1),n=l+d,n>i&&(n=i),c=m;n>=c;c++)e.push(c);o=a.grep(o,function(b,c){return a.inArray(b,o)===c}),g=o.length,h=e.length,g-h>j/2&&g+h>b.maxOptionSize&&(f=Math.floor(g/2)-Math.floor(h/2),Array.prototype.splice.apply(o,[f,h])),o=o.concat(e)}return o=a.grep(o,function(b,c){return a.inArray(b,o)===c}).sort(function(a,b){return a-b})},i=function(b,c){var d,e,f=b.config,g=f.$tbodies.eq(0);g.find("tr.pagerSavedHeightSpacer").remove(),c.fixedHeight&&!c.isDisabled&&(e=a.data(b,"pagerSavedHeight"),e&&(d=e-g.height(),d>5&&a.data(b,"pagerLastSize")===c.size&&g.children("tr:visible").length')))},j=function(b,c){var d,e=b.config,f=e.$tbodies.eq(0);f.find("tr.pagerSavedHeightSpacer").remove(),f.children("tr:visible").length||f.append(' '),d=f.children("tr").eq(0).height()*c.size,a.data(b,"pagerSavedHeight",d),i(b,c),a.data(b,"pagerLastSize",c.size)},k=function(a,c){if(!c.ajaxUrl){var d,e=0,f=a.config,g=f.$tbodies.eq(0).children("tr"),h=g.length,i=c.page*c.size,j=i+c.size,k=f.widgetOptions&&f.widgetOptions.filter_filteredRow||"filtered",l=0,m=0;for(c.cacheIndex=[],d=0;h>d;d++)g[d].className.match(k)||(m===i&&g[d].className.match(f.cssChildRow)?g[d].style.display="none":(g[d].style.display=m>=i&&j>m?"":"none",l!==m&&m>=i&&j>m&&(c.cacheIndex.push(d),l=m),m+=g[d].className.match(f.cssChildRow+"|"+f.selectorRemove.slice(1))&&!c.countChildRows?0:1,m===j&&"none"!==g[d].style.display&&g[d].className.match(b.css.cssHasChild)&&(e=d)));if(e>0&&g[e].className.match(b.css.cssHasChild))for(;++e> Ajax Error",f,h),b.showError(d,0===f.status?"Not connected, verify Network":404===f.status?"Requested page not found [404]":500===f.status?"Internal Server Error [500]":"parsererror"===h?"Requested JSON parse failed":"timeout"===h?"Time out error":"abort"===h?"Ajax Request aborted":"Uncaught error: "+f.statusText+" ["+f.status+"]"),s.$tbodies.eq(0).children("tr").detach(),e.totalRows=0;else{if(a.isArray(v)?(n=isNaN(v[0])&&!isNaN(v[1]),r=v[n?1:0],e.totalRows=isNaN(r)?e.totalRows||0:r,s.totalRows=s.filteredRows=e.filteredRows=e.totalRows,p=0===e.totalRows?[""]:v[n?0:1]||[],o=v[2]):(e.ajaxData=v,s.totalRows=e.totalRows=v.total,s.filteredRows=e.filteredRows="undefined"!=typeof v.filteredRows?v.filteredRows:v.total,o=v.headers,p=v.rows),q=p&&p.length,p instanceof jQuery)e.processAjaxOnInit&&(s.$tbodies.eq(0).children("tr").detach(),s.$tbodies.eq(0).append(p));else if(q){for(i=0;q>i;i++){for(u+="",j=0;j"+p[i][j]+"";u+=""}e.processAjaxOnInit&&s.$tbodies.eq(0).html(u)}e.processAjaxOnInit=!0,o&&o.length===w&&(k=t.hasClass("hasStickyHeaders"),m=k?s.widgetOptions.$sticky.children("thead:first").children("tr").children():"",l=t.find("tfoot tr:first").children(),s.$headers.filter("th").each(function(c){var d,e=a(this);e.find("."+b.css.icon).length?(d=e.find("."+b.css.icon).clone(!0),e.find(".tablesorter-header-inner").html(o[c]).append(d),k&&m.length&&(d=m.eq(c).find("."+b.css.icon).clone(!0),m.eq(c).find(".tablesorter-header-inner").html(o[c]).append(d))):(e.find(".tablesorter-header-inner").html(o[c]),k&&m.length&&m.eq(c).find(".tablesorter-header-inner").html(o[c])),l.eq(c).html(o[c])}))}s.showProcessing&&b.isProcessing(d),e.totalPages=Math.ceil(e.totalRows/(e.size||e.settings.size||10)),e.last.totalRows=e.totalRows,e.last.currentFilters=e.currentFilters,e.last.sortList=(s.sortList||[]).join(","),g(d,e,!1),t.trigger("updateCache",[function(){e.initialized&&setTimeout(function(){s.debug&&b.log("Pager: Triggering pagerChange"),t.trigger("applyWidgets").trigger("pagerChange",e),g(d,e,!0)},0)}])}e.initialized||(e.initialized=!0,e.initializing=!1,d.config.debug&&b.log("Pager: Triggering pagerInitialized"),a(d).trigger("applyWidgets").trigger("pagerInitialized",e),g(d,e))},n=function(c,d){var e,f=o(c,d),g=a(document),h=c.config;""!==f&&(h.showProcessing&&b.isProcessing(c,!0),g.bind("ajaxError.pager",function(a,b,e,f){m(null,c,d,b,f),g.unbind("ajaxError.pager")}),e=++d.ajaxCounter,d.last.ajaxUrl=f,d.ajaxObject.url=f,d.ajaxObject.success=function(a,b,f){ee;e++)m.push(k+"["+i[e][0]+"]="+i[e][1]);h=h.replace(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/g,m.length?m.join("&"):k),m=[]}if(l){for(l=l[1],f=j.length,e=0;f>e;e++)j[e]&&m.push(l+"["+e+"]="+encodeURIComponent(j[e]));h=h.replace(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/g,m.length?m.join("&"):l),d.currentFilters=j}return"function"==typeof d.customAjaxUrl&&(h=d.customAjaxUrl(c,h)),g.debug&&b.log("Pager: Ajax url = "+h),h},p=function(c,d,e){var f,h,i,j,l=a(c),m=c.config,n=m.$table.hasClass("hasFilters"),o=d&&d.length||0,p=e.page*e.size,q=e.size;if(1>o)return void(m.debug&&b.log("Pager: >> No rows for pager to render"));if(e.page>=e.totalPages&&v(c,e),e.cacheIndex=[],e.isDisabled=!1,e.initialized&&(m.debug&&b.log("Pager: Triggering pagerChange"),l.trigger("pagerChange",e)),e.removeRows){for(b.clearTableBody(c),f=b.processTbody(c,m.$tbodies.eq(0),!0),h=n?0:p,i=n?0:p,j=0;q>j&&hp&&q>=j&&(j++,e.cacheIndex.push(h),f.append(d[h]))),h++;b.processTbody(c,f,!1)}else k(c,e);g(c,e),c.isUpdating&&(m.debug&&b.log("Pager: Triggering updateComplete"),l.trigger("updateComplete",[c,!0]))},q=function(c,d){d.ajax?e(d,!0):(d.isDisabled=!0,a.data(c,"pagerLastPage",d.page),a.data(c,"pagerLastSize",d.size),d.page=0,d.size=d.totalRows,d.totalPages=1,a(c).addClass("pagerDisabled").removeAttr("aria-describedby").find("tr.pagerSavedHeightSpacer").remove(),p(c,c.config.rowsCopy,d),a(c).trigger("applyWidgets"),c.config.debug&&b.log("Pager: Disabled")),d.$size.add(d.$goto).add(d.$container.find(".ts-startRow, .ts-page")).each(function(){a(this).attr("aria-disabled","true").addClass(d.cssDisabled)[0].disabled=!0})},r=function(a){var b=a.config,c=b.pager;b.$table.trigger("updateCache",[function(){var d,e=[],f=a.config.cache[0].normalized;for(c.totalRows=f.length,d=0;dg-1&&0!==g&&(d.page=g-1),j.currentFilters=""===(j.currentFilters||[]).join("")?[]:j.currentFilters,d.currentFilters=""===(d.currentFilters||[]).join("")?[]:d.currentFilters,(j.page!==d.page||j.size!==d.size||j.totalRows!==d.totalRows||(j.currentFilters||[]).join(",")!==(d.currentFilters||[]).join(",")||(j.ajaxUrl||"")!==(d.ajaxObject.url||"")||(j.optAjaxUrl||"")!==(d.ajaxUrl||"")||j.sortList!==(h.sortList||[]).join(","))&&(h.debug&&b.log("Pager: Changing to page "+d.page),d.last={page:d.page,size:d.size,sortList:(h.sortList||[]).join(","),totalRows:d.totalRows,currentFilters:d.currentFilters||[],ajaxUrl:d.ajaxObject.url||"",optAjaxUrl:d.ajaxUrl||""},d.ajax?n(c,d):d.ajax||p(c,h.rowsCopy,d),a.data(c,"pagerLastPage",d.page),d.initialized&&e!==!1&&(h.debug&&b.log("Pager: Triggering pageMoved"),i.trigger("pageMoved",d).trigger("applyWidgets"),c.isUpdating&&(h.debug&&b.log("Pager: Triggering updateComplete"),i.trigger("updateComplete",[c,!0]))))))}},t=function(b,c,d){d.size=c||d.size||d.settings.size||10,d.$size.val(d.size),a.data(b,"pagerLastPage",d.page),a.data(b,"pagerLastSize",d.size),d.totalPages=Math.ceil(d.totalRows/d.size),d.filteredPages=Math.ceil(d.filteredRows/d.size),s(b,d)},u=function(a,b){b.page=0,s(a,b)},v=function(a,b){b.page=Math.min(b.totalPages,b.filteredPages)-1,s(a,b)},w=function(a,b){b.page++,b.page>=Math.min(b.totalPages,b.filteredPages)-1&&(b.page=Math.min(b.totalPages,b.filteredPages)-1),s(a,b)},x=function(a,b){b.page--,b.page<=0&&(b.page=0),s(a,b)},y=function(d,e){q(d,e),e.$container.hide(),d.config.appender=null,e.initialized=!1,delete d.config.rowsCopy,a(d).unbind(c.split(" ").join(".pager ").replace(/\s+/g," ")),b.storage&&b.storage(d,e.storageKey,"")},z=function(c,d,e){var f,g=c.config;d.$size.add(d.$goto).add(d.$container.find(".ts-startRow, .ts-page")).removeClass(d.cssDisabled).removeAttr("disabled").attr("aria-disabled","false"),d.isDisabled=!1,d.page=a.data(c,"pagerLastPage")||d.page||0,d.size=a.data(c,"pagerLastSize")||parseInt(d.$size.find("option[selected]").val(),10)||d.size||d.settings.size||10,d.$size.val(d.size),d.totalPages=Math.ceil(Math.min(d.totalRows,d.filteredRows)/d.size),c.id&&(f=c.id+"_pager_info",d.$container.find(d.cssPageDisplay).attr("id",f),g.$table.attr("aria-describedby",f)),j(c,d),e&&(g.$table.trigger("updateRows"),t(c,d.size,d),l(c,d),g.debug&&b.log("Pager: Enabled"))};d.appender=function(b,c){var d=b.config,e=d.pager;e.ajax||(d.rowsCopy=c,e.totalRows=e.countChildRows?d.$tbodies.eq(0).children("tr").length:c.length,e.size=a.data(b,"pagerLastSize")||e.size||e.settings.size||10,e.totalPages=Math.ceil(e.totalRows/e.size),p(b,c,e),g(b,e,!1))},d.construct=function(e){return this.each(function(){if(this.config&&this.hasInitialized){var f,h,i,m=this,n=m.config,o=n.widgetOptions,p=n.pager=a.extend(!0,{},a.tablesorterPager.defaults,e),A=n.$table,B=p.$container=a(p.container).addClass("tablesorter-pager").show();p.settings=a.extend(!0,{},a.tablesorterPager.defaults,e),n.debug&&b.log("Pager: Initializing"),p.oldAjaxSuccess=p.oldAjaxSuccess||p.ajaxObject.success,n.appender=d.appender,p.initializing=!0,p.savePages&&b.storage&&(f=b.storage(m,p.storageKey)||{},p.page=isNaN(f.page)?p.page:f.page,p.size=(isNaN(f.size)?p.size:f.size)||p.settings.size||10,a.data(m,"pagerLastSize",p.size)),p.regexRows=new RegExp("("+(o.filter_filteredRow||"filtered")+"|"+n.selectorRemove.slice(1)+"|"+n.cssChildRow+")"),A.unbind(c.split(" ").join(".pager ").replace(/\s+/g," ")).bind("filterInit.pager filterStart.pager",function(b,c){p.currentFilters=a.isArray(c)?c:n.$table.data("lastSearch"),"filterStart"===b.type&&p.pageReset!==!1&&(n.lastCombinedFilter||"")!==(p.currentFilters||[]).join("")&&(p.page=p.pageReset)}).bind("filterEnd.pager sortEnd.pager",function(){p.currentFilters=n.$table.data("lastSearch"),(p.initialized||p.initializing)&&(n.delayInit&&n.rowsCopy&&0===n.rowsCopy.length&&r(m),g(m,p,!1),s(m,p,!1),n.$table.trigger("applyWidgets"))}).bind("disable.pager",function(a){a.stopPropagation(),q(m,p)}).bind("enable.pager",function(a){a.stopPropagation(),z(m,p,!0)}).bind("destroy.pager",function(a){a.stopPropagation(),y(m,p)}).bind("updateComplete.pager",function(a,b,c){if(a.stopPropagation(),b&&!c){var d=n.$tbodies.eq(0).children("tr").not(n.selectorRemove);p.totalRows=d.length-(p.countChildRows?0:d.filter("."+n.cssChildRow).length),p.totalPages=Math.ceil(p.totalRows/p.size),d.length&&n.rowsCopy&&0===n.rowsCopy.length&&r(b),p.page>=p.totalPages&&v(b,p),k(b,p),j(b,p),g(b,p,!0)}}).bind("pageSize.pager refreshComplete.pager",function(a,b){a.stopPropagation(),t(m,parseInt(b,10)||p.settings.size||10,p),k(m,p),g(m,p,!1)}).bind("pageSet.pager pagerUpdate.pager",function(a,b){a.stopPropagation(),p.page=(parseInt(b,10)||1)-1,"pagerUpdate"===a.type&&(p.last.page=!0),s(m,p,!0),g(m,p,!1)}).bind("pageAndSize.pager",function(a,b,c){a.stopPropagation(),p.page=(parseInt(b,10)||1)-1,t(m,parseInt(c,10)||p.settings.size||10,p),s(m,p,!0),k(m,p),g(m,p,!1)}),h=[p.cssFirst,p.cssPrev,p.cssNext,p.cssLast],i=[u,x,w,v],n.debug&&!B.length&&b.log("Pager: >> Container not found"),B.find(h.join(",")).attr("tabindex",0).unbind("click.pager").bind("click.pager",function(b){b.stopPropagation();var c,d=a(this),e=h.length;if(!d.hasClass(p.cssDisabled))for(c=0;e>c;c++)if(d.is(h[c])){i[c](m,p);break}}),p.$goto=B.find(p.cssGoto),p.$goto.length?p.$goto.unbind("change.pager").bind("change.pager",function(){p.page=a(this).val()-1,s(m,p,!0),g(m,p,!1)}):n.debug&&b.log("Pager: >> Goto selector not found"),p.$size=B.find(p.cssPageSize),p.$size.length?(p.$size.find("option").removeAttr("selected"),p.$size.unbind("change.pager").bind("change.pager",function(){return p.$size.val(a(this).val()),a(this).hasClass(p.cssDisabled)||(t(m,parseInt(a(this).val(),10),p),j(m,p)),!1})):n.debug&&b.log("Pager: >> Size selector not found"),p.initialized=!1,A.trigger("pagerBeforeInitialized",p),z(m,p,!1),"string"==typeof p.ajaxUrl?(p.ajax=!0,n.widgetOptions.filter_serversideFiltering=!0,n.serverSideSorting=!0,s(m,p)):(p.ajax=!1,a(this).trigger("appendCache",!0),l(m,p)),p.ajax||p.initialized||(p.initializing=!1,p.initialized=!0,s(m,p),n.debug&&b.log("Pager: Triggering pagerInitialized"),n.$table.trigger("pagerInitialized",p),n.widgetOptions.filter_initialized&&b.hasWidget(m,"filter")||g(m,p,!1))}})}}}),b.showError=function(b,c){a(b).each(function(){var b,d=this.config,e=d.pager&&d.pager.cssErrorRow||d.widgetOptions.pager_css&&d.widgetOptions.pager_css.errorRow||"tablesorter-errorRow";d&&("undefined"==typeof c?d.$table.find("thead").find(d.selectorRemove).remove():b=a(/tr\>/.test(c)?c:''+c+"").click(function(){a(this).remove()}).appendTo(d.$table.find("thead:first")).addClass(e+" "+d.selectorRemove.slice(1)).attr({role:"alert","aria-live":"assertive"}))})},a.fn.extend({tablesorterPager:a.tablesorterPager.construct})}(jQuery),function(a){var b=a.tablesorter;a.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(a,b){return b},ajaxObject:{dataType:"json"},processAjaxOnInit:!0,ajaxProcessing:function(){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,pageReset:0,size:10,maxOptionSize:20,savePages:!0,storageKey:"tablesorter-pager",fixedHeight:!1,countChildRows:!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,ajaxCounter:0,currentFilters:[],startRow:0,endRow:0,$size:null,last:{}};var c=this,d=function(a,b){var c=a.cssDisabled,d=!!b,e=d||0===a.page,f=Math.min(a.totalPages,a.filteredPages),d=d||a.page===f-1||0===f;a.updateArrows&&(a.$container.find(a.cssFirst+","+a.cssPrev)[e?"addClass":"removeClass"](c).attr("aria-disabled",e),a.$container.find(a.cssNext+","+a.cssLast)[d?"addClass":"removeClass"](c).attr("aria-disabled",d))},e=function(b,c){var d,e=b.config;(d=e.$table.hasClass("hasFilters"))&&!c.ajaxUrl?a.isEmptyObject(e.cache)?c.filteredRows=c.totalRows=e.$tbodies.eq(0).children("tr").not(c.countChildRows?"":"."+e.cssChildRow).length:(d=e.$table.children("tbody").index(e.$tbodies.eq(0)),c.filteredRows=0,a.each(e.cache[d].normalized,function(a,b){c.filteredRows+=c.regexRows.test(b[e.columns].$row[0].className)?0:1})):d||(c.filteredRows=c.totalRows)},f=function(c,f,i){if(!f.initializing){var j,k,l,m=c.config;j=f.size||f.settings.size||10,f.countChildRows&&k.push(m.cssChildRow),f.totalPages=Math.ceil(f.totalRows/j),m.totalRows=f.totalRows,e(c,f),m.filteredRows=f.filteredRows,f.filteredPages=Math.ceil(f.filteredRows/j)||0,0<=Math.min(f.totalPages,f.filteredPages)&&(k=f.size*f.page>f.filteredRows&&i,f.page=k?f.pageReset||0:f.page,f.startRow=k?f.size*f.page+1:0===f.filteredRows?0:f.size*f.page+1,f.endRow=Math.min(f.filteredRows,f.totalRows,f.size*(f.page+1)),l=f.$container.find(f.cssPageDisplay),j=(f.ajaxData&&f.ajaxData.output?f.ajaxData.output||f.output:f.output).replace(/\{page([\-+]\d+)?\}/gi,function(a,b){return f.totalPages?f.page+(b?parseInt(b,10):1):0}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(a){var b,c;b=a.replace(/[{}\s]/g,""),a=b.split(":"),c=f.ajaxData;var d=/(rows?|pages?)$/i.test(b)?0:"";return/(startRow|page)/.test(a[0])&&"input"===a[1]?(b=(""+("page"===a[0]?f.totalPages:f.totalRows)).length,c="page"===a[0]?f.page+1:f.startRow,''):1'+b+""}),f.$goto.html(k).val(f.page+1)),l.length&&(l["INPUT"===l[0].tagName?"val":"html"](j),l.find(".ts-startRow, .ts-page").unbind("change.pager").bind("change.pager",function(){var b=a(this).val(),b=a(this).hasClass("ts-startRow")?Math.floor(b/f.size)+1:b;m.$table.trigger("pageSet.pager",[b])}))),d(f),h(c,f),f.initialized&&!1!==i&&(m.$table.trigger("pagerComplete",f),f.savePages&&b.storage&&b.storage(c,f.storageKey,{page:f.page,size:f.size}))}},g=function(b){var c,d,e,f,g;g=Math.min(b.totalPages,b.filteredPages)||1;var h=5*Math.ceil(g/b.maxOptionSize/5);e=g>b.maxOptionSize,f=b.page+1,c=h,d=g-h;var i=[1];for(c=e?h:1;g>=c;)i.push(c),c+=e?h:1;if(i.push(g),e){for(e=[],d=Math.max(Math.floor(b.maxOptionSize/h)-1,5),c=f-d,1>c&&(c=1),d=f+d,d>g&&(d=g);d>=c;c++)e.push(c);i=a.grep(i,function(b,c){return a.inArray(b,i)===c}),f=i.length,g=e.length,f-g>h/2&&f+g>b.maxOptionSize&&(b=Math.floor(f/2)-Math.floor(g/2),Array.prototype.splice.apply(i,[b,g])),i=i.concat(e)}return i=a.grep(i,function(b,c){return a.inArray(b,i)===c}).sort(function(a,b){return a-b})},h=function(b,c){var d,e=b.config,f=e.$tbodies.eq(0);f.find("tr.pagerSavedHeightSpacer").remove(),c.fixedHeight&&!c.isDisabled&&(d=a.data(b,"pagerSavedHeight"))&&(d-=f.height(),d>5&&a.data(b,"pagerLastSize")===c.size&&f.children("tr:visible").length'))},i=function(b,c){var d;d=b.config;var e=d.$tbodies.eq(0);e.find("tr.pagerSavedHeightSpacer").remove(),e.children("tr:visible").length||e.append(' '),d=e.children("tr").eq(0).height()*c.size,a.data(b,"pagerSavedHeight",d),h(b,c),a.data(b,"pagerLastSize",c.size)},j=function(a,c){if(!c.ajaxUrl){var d,e=0,f=a.config,g=f.$tbodies.eq(0).children("tr"),h=g.length,i=c.page*c.size,j=i+c.size,k=f.widgetOptions&&f.widgetOptions.filter_filteredRow||"filtered",l=0,m=0;for(c.cacheIndex=[],d=0;h>d;d++)g[d].className.match(k)||(m===i&&g[d].className.match(f.cssChildRow)?g[d].style.display="none":(g[d].style.display=m>=i&&j>m?"":"none",l!==m&&m>=i&&j>m&&(c.cacheIndex.push(d),l=m),m+=g[d].className.match(f.cssChildRow+"|"+f.selectorRemove.slice(1))&&!c.countChildRows?0:1,m===j&&"none"!==g[d].style.display&&g[d].className.match(b.css.cssHasChild)&&(e=d)));if(e>0&&g[e].className.match(b.css.cssHasChild))for(;++ei;i++){for(q+="",h=0;h"+g[i][h]+"";q+=""}e.processAjaxOnInit&&o.$tbodies.eq(0).html(q)}e.processAjaxOnInit=!0,m&&m.length===c&&(l=(j=p.hasClass("hasStickyHeaders"))?o.widgetOptions.$sticky.children("thead:first").children("tr").children():"",k=p.find("tfoot tr:first").children(),o.$headers.filter("th").each(function(c){var d,e=a(this);e.find("."+b.css.icon).length?(d=e.find("."+b.css.icon).clone(!0),e.find(".tablesorter-header-inner").html(m[c]).append(d),j&&l.length&&(d=l.eq(c).find("."+b.css.icon).clone(!0),l.eq(c).find(".tablesorter-header-inner").html(m[c]).append(d))):(e.find(".tablesorter-header-inner").html(m[c]),j&&l.length&&l.eq(c).find(".tablesorter-header-inner").html(m[c])),k.eq(c).html(m[c])}))}o.showProcessing&&b.isProcessing(d),e.totalPages=Math.ceil(e.totalRows/(e.size||e.settings.size||10)),e.last.totalRows=e.totalRows,e.last.currentFilters=e.currentFilters,e.last.sortList=(o.sortList||[]).join(","),f(d,e,!1),p.trigger("updateCache",[function(){e.initialized&&setTimeout(function(){p.trigger("applyWidgets").trigger("pagerChange",e),f(d,e,!0)},0)}])}e.initialized||(e.initialized=!0,e.initializing=!1,a(d).trigger("applyWidgets").trigger("pagerInitialized",e),f(d,e))},m=function(c,d){var e,f=n(c,d),g=a(document),h=c.config;""!==f&&(h.showProcessing&&b.isProcessing(c,!0),g.bind("ajaxError.pager",function(a,b,e,f){l(null,c,d,b,f),g.unbind("ajaxError.pager")}),e=++d.ajaxCounter,d.last.ajaxUrl=f,d.ajaxObject.url=f,d.ajaxObject.success=function(a,b,f){e(d&&d.length||0))g.debug&&b.log("Pager: no rows for pager to render");else{if(e.page>=e.totalPages&&u(c,e),e.cacheIndex=[],e.isDisabled=!1,e.initialized&&l.trigger("pagerChange",e),e.removeRows){for(b.clearTableBody(c),g=b.processTbody(c,g.$tbodies.eq(0),!0),h=m?0:n,i=m?0:n,k=0;o>k&&hn&&o>=k&&(k++,e.cacheIndex.push(h),g.append(d[h]))),h++;b.processTbody(c,g,!1)}else j(c,e);f(c,e),c.isUpdating&&l.trigger("updateComplete",[c,!0])}},p=function(c,e){e.ajax?d(e,!0):(e.isDisabled=!0,a.data(c,"pagerLastPage",e.page),a.data(c,"pagerLastSize",e.size),e.page=0,e.size=e.totalRows,e.totalPages=1,a(c).addClass("pagerDisabled").removeAttr("aria-describedby").find("tr.pagerSavedHeightSpacer").remove(),o(c,c.config.rowsCopy,e),a(c).trigger("applyWidgets"),c.config.debug&&b.log("pager disabled")),e.$size.add(e.$goto).add(e.$container.find(".ts-startRow, .ts-page")).each(function(){a(this).attr("aria-disabled","true").addClass(e.cssDisabled)[0].disabled=!0})},q=function(a){var b=a.config,c=b.pager;b.$table.trigger("updateCache",[function(){var d,e=[];d=b.$table.children("tbody").index(b.$tbodies.eq(0));var f=a.config.cache[d].normalized;for(c.totalRows=f.length,d=0;dd.page&&(d.page=0),d.page>g-1&&0!==g&&(d.page=g-1),j.currentFilters=""===(j.currentFilters||[]).join("")?[]:j.currentFilters,d.currentFilters=""===(d.currentFilters||[]).join("")?[]:d.currentFilters,(j.page!==d.page||j.size!==d.size||j.totalRows!==d.totalRows||(j.currentFilters||[]).join(",")!==(d.currentFilters||[]).join(",")||(j.ajaxUrl||"")!==(d.ajaxObject.url||"")||(j.optAjaxUrl||"")!==(d.ajaxUrl||"")||j.sortList!==(h.sortList||[]).join(","))&&(h.debug&&b.log("Pager changing to page "+d.page),d.last={page:d.page,size:d.size,sortList:(h.sortList||[]).join(","),totalRows:d.totalRows,currentFilters:d.currentFilters||[],ajaxUrl:d.ajaxObject.url||"",optAjaxUrl:d.ajaxUrl||""},d.ajax?m(c,d):d.ajax||o(c,h.rowsCopy,d),a.data(c,"pagerLastPage",d.page),d.initialized&&!1!==f&&(i.trigger("pageMoved",d).trigger("applyWidgets"),c.isUpdating&&i.trigger("updateComplete",[c,!0]))))}},s=function(b,c,d){d.size=c||d.size||d.settings.size||10,d.$size.val(d.size),a.data(b,"pagerLastPage",d.page),a.data(b,"pagerLastSize",d.size),d.totalPages=Math.ceil(d.totalRows/d.size),d.filteredPages=Math.ceil(d.filteredRows/d.size),r(b,d)},t=function(a,b){b.page=0,r(a,b)},u=function(a,b){b.page=Math.min(b.totalPages,b.filteredPages)-1,r(a,b)},v=function(a,b){b.page++,b.page>=Math.min(b.totalPages,b.filteredPages)-1&&(b.page=Math.min(b.totalPages,b.filteredPages)-1),r(a,b)},w=function(a,b){b.page--,0>=b.page&&(b.page=0),r(a,b)},x=function(c,d,e){var f,g=c.config;d.$size.add(d.$goto).add(d.$container.find(".ts-startRow, .ts-page")).removeClass(d.cssDisabled).removeAttr("disabled").attr("aria-disabled","false"),d.isDisabled=!1,d.page=a.data(c,"pagerLastPage")||d.page||0,d.size=a.data(c,"pagerLastSize")||parseInt(d.$size.find("option[selected]").val(),10)||d.size||d.settings.size||10,d.$size.val(d.size),d.totalPages=Math.ceil(Math.min(d.totalRows,d.filteredRows)/d.size),c.id&&(f=c.id+"_pager_info",d.$container.find(d.cssPageDisplay).attr("id",f),g.$table.attr("aria-describedby",f)),i(c,d),e&&(g.$table.trigger("updateRows"),s(c,d.size,d),k(c,d),g.debug&&b.log("pager enabled"))};c.appender=function(b,c){var d=b.config,e=d.pager;e.ajax||(d.rowsCopy=c,e.totalRows=e.countChildRows?d.$tbodies.eq(0).children("tr").length:c.length,e.size=a.data(b,"pagerLastSize")||e.size||e.settings.size||10,e.totalPages=Math.ceil(e.totalRows/e.size),o(b,c,e),f(b,e,!1))},c.construct=function(d){return this.each(function(){if(this.config&&this.hasInitialized){var e,g,h,l=this,m=l.config,n=m.widgetOptions,o=m.pager=a.extend(!0,{},a.tablesorterPager.defaults,d),y=m.$table,z=o.$container=a(o.container).addClass("tablesorter-pager").show();o.settings=a.extend(!0,{},a.tablesorterPager.defaults,d),m.debug&&b.log("Pager initializing"),o.oldAjaxSuccess=o.oldAjaxSuccess||o.ajaxObject.success,m.appender=c.appender,o.initializing=!0,o.savePages&&b.storage&&(e=b.storage(l,o.storageKey)||{},o.page=isNaN(e.page)?o.page:e.page,o.size=(isNaN(e.size)?o.size:e.size)||o.settings.size||10,a.data(l,"pagerLastSize",o.size)),o.regexRows=new RegExp("("+(n.filter_filteredRow||"filtered")+"|"+m.selectorRemove.slice(1)+"|"+m.cssChildRow+")"),y.unbind(a.trim("filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet pageAndSize pagerUpdate ".split(" ").join(".pager "))).bind("filterInit.pager filterStart.pager",function(b,c){o.currentFilters=a.isArray(c)?c:m.$table.data("lastSearch"),"filterStart"===b.type&&!1!==o.pageReset&&(m.lastCombinedFilter||"")!==(o.currentFilters||[]).join("")&&(o.page=o.pageReset) +!function(a){"use strict";var b=a.tablesorter;a.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(a,b){return b},ajaxObject:{dataType:"json"},processAjaxOnInit:!0,ajaxProcessing:function(){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,pageReset:0,size:10,maxOptionSize:20,savePages:!0,storageKey:"tablesorter-pager",fixedHeight:!1,countChildRows:!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,ajaxCounter:0,currentFilters:[],startRow:0,endRow:0,$size:null,last:{}};var c="filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet pageAndSize pagerUpdate ",d=this,e=function(a,b){var c="addClass",d="removeClass",e=a.cssDisabled,f=!!b,g=f||0===a.page,h=Math.min(a.totalPages,a.filteredPages),i=f||a.page===h-1||0===h;a.updateArrows&&(a.$container.find(a.cssFirst+","+a.cssPrev)[g?c:d](e).attr("aria-disabled",g),a.$container.find(a.cssNext+","+a.cssLast)[i?c:d](e).attr("aria-disabled",i))},f=function(b,c){var d,e,f,g=b.config,h=g.$table.hasClass("hasFilters");if(h&&!c.ajaxUrl)if(a.isEmptyObject(g.cache))c.filteredRows=c.totalRows=g.$tbodies.eq(0).children("tr").not(c.countChildRows?"":"."+g.cssChildRow).length;else for(c.filteredRows=0,d=g.cache[0].normalized,f=d.length,e=0;f>e;e++)c.filteredRows+=c.regexRows.test(d[e][g.columns].$row[0].className)?0:1;else h||(c.filteredRows=c.totalRows)},g=function(c,d,g){if(!d.initializing){var j,k,l,m,n,o,p=c.config,q=d.size||d.settings.size||10;if(d.countChildRows&&k.push(p.cssChildRow),d.totalPages=Math.ceil(d.totalRows/q),p.totalRows=d.totalRows,f(c,d),p.filteredRows=d.filteredRows,d.filteredPages=Math.ceil(d.filteredRows/q)||0,Math.min(d.totalPages,d.filteredPages)>=0){if(k=d.size*d.page>d.filteredRows&&g,d.page=k?d.pageReset||0:d.page,d.startRow=k?d.size*d.page+1:0===d.filteredRows?0:d.size*d.page+1,d.endRow=Math.min(d.filteredRows,d.totalRows,d.size*(d.page+1)),l=d.$container.find(d.cssPageDisplay),j=(d.ajaxData&&d.ajaxData.output?d.ajaxData.output||d.output:d.output).replace(/\{page([\-+]\d+)?\}/gi,function(a,b){return d.totalPages?d.page+(b?parseInt(b,10):1):0}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(a){var b,c,e=a.replace(/[{}\s]/g,""),f=e.split(":"),g=d.ajaxData,h=/(rows?|pages?)$/i.test(e)?0:"";return/(startRow|page)/.test(f[0])&&"input"===f[1]?(b=(""+("page"===f[0]?d.totalPages:d.totalRows)).length,c="page"===f[0]?d.page+1:d.startRow,''):f.length>1&&g&&g[f[0]]?g[f[0]][f[1]]:d[e]||(g?g[e]:h)||h}),d.$goto.length){for(k="",o=h(d),n=o.length,m=0;n>m;m++)k+='";d.$goto.html(k).val(d.page+1)}l.length&&(l["INPUT"===l[0].tagName?"val":"html"](j),l.find(".ts-startRow, .ts-page").unbind("change.pager").bind("change.pager",function(){var b=a(this).val(),c=a(this).hasClass("ts-startRow")?Math.floor(b/d.size)+1:b;p.$table.trigger("pageSet.pager",[c])}))}e(d),i(c,d),d.initialized&&g!==!1&&(p.debug&&b.log("Pager: Triggering pagerComplete"),p.$table.trigger("pagerComplete",d),d.savePages&&b.storage&&b.storage(c,d.storageKey,{page:d.page,size:d.size}))}},h=function(b){var c,d,e,f,g,h,i=Math.min(b.totalPages,b.filteredPages)||1,j=5*Math.ceil(i/b.maxOptionSize/5),k=i>b.maxOptionSize,l=b.page+1,m=j,n=i-j,o=[1],p=k?j:1;for(c=p;i>=c;)o.push(c),c+=k?j:1;if(o.push(i),k){for(e=[],d=Math.max(Math.floor(b.maxOptionSize/j)-1,5),m=l-d,1>m&&(m=1),n=l+d,n>i&&(n=i),c=m;n>=c;c++)e.push(c);o=a.grep(o,function(b,c){return a.inArray(b,o)===c}),g=o.length,h=e.length,g-h>j/2&&g+h>b.maxOptionSize&&(f=Math.floor(g/2)-Math.floor(h/2),Array.prototype.splice.apply(o,[f,h])),o=o.concat(e)}return o=a.grep(o,function(b,c){return a.inArray(b,o)===c}).sort(function(a,b){return a-b})},i=function(b,c){var d,e,f=b.config,g=f.$tbodies.eq(0);g.find("tr.pagerSavedHeightSpacer").remove(),c.fixedHeight&&!c.isDisabled&&(e=a.data(b,"pagerSavedHeight"),e&&(d=e-g.height(),d>5&&a.data(b,"pagerLastSize")===c.size&&g.children("tr:visible").length')))},j=function(b,c){var d,e=b.config,f=e.$tbodies.eq(0);f.find("tr.pagerSavedHeightSpacer").remove(),f.children("tr:visible").length||f.append(' '),d=f.children("tr").eq(0).height()*c.size,a.data(b,"pagerSavedHeight",d),i(b,c),a.data(b,"pagerLastSize",c.size)},k=function(a,c){if(!c.ajaxUrl){var d,e=0,f=a.config,g=f.$tbodies.eq(0).children("tr"),h=g.length,i=c.page*c.size,j=i+c.size,k=f.widgetOptions&&f.widgetOptions.filter_filteredRow||"filtered",l=0,m=0;for(c.cacheIndex=[],d=0;h>d;d++)g[d].className.match(k)||(m===i&&g[d].className.match(f.cssChildRow)?g[d].style.display="none":(g[d].style.display=m>=i&&j>m?"":"none",l!==m&&m>=i&&j>m&&(c.cacheIndex.push(d),l=m),m+=g[d].className.match(f.cssChildRow+"|"+f.selectorRemove.slice(1))&&!c.countChildRows?0:1,m===j&&"none"!==g[d].style.display&&g[d].className.match(b.css.cssHasChild)&&(e=d)));if(e>0&&g[e].className.match(b.css.cssHasChild))for(;++e> Ajax Error",f,h),b.showError(d,0===f.status?"Not connected, verify Network":404===f.status?"Requested page not found [404]":500===f.status?"Internal Server Error [500]":"parsererror"===h?"Requested JSON parse failed":"timeout"===h?"Time out error":"abort"===h?"Ajax Request aborted":"Uncaught error: "+f.statusText+" ["+f.status+"]"),s.$tbodies.eq(0).children("tr").detach(),e.totalRows=0;else{if(a.isArray(v)?(n=isNaN(v[0])&&!isNaN(v[1]),r=v[n?1:0],e.totalRows=isNaN(r)?e.totalRows||0:r,s.totalRows=s.filteredRows=e.filteredRows=e.totalRows,p=0===e.totalRows?[""]:v[n?0:1]||[],o=v[2]):(e.ajaxData=v,s.totalRows=e.totalRows=v.total,s.filteredRows=e.filteredRows="undefined"!=typeof v.filteredRows?v.filteredRows:v.total,o=v.headers,p=v.rows),q=p&&p.length,p instanceof jQuery)e.processAjaxOnInit&&(s.$tbodies.eq(0).children("tr").detach(),s.$tbodies.eq(0).append(p));else if(q){for(i=0;q>i;i++){for(u+="",j=0;j"+p[i][j]+"";u+=""}e.processAjaxOnInit&&s.$tbodies.eq(0).html(u)}e.processAjaxOnInit=!0,o&&o.length===w&&(k=t.hasClass("hasStickyHeaders"),m=k?s.widgetOptions.$sticky.children("thead:first").children("tr").children():"",l=t.find("tfoot tr:first").children(),s.$headers.filter("th").each(function(c){var d,e=a(this);e.find("."+b.css.icon).length?(d=e.find("."+b.css.icon).clone(!0),e.find(".tablesorter-header-inner").html(o[c]).append(d),k&&m.length&&(d=m.eq(c).find("."+b.css.icon).clone(!0),m.eq(c).find(".tablesorter-header-inner").html(o[c]).append(d))):(e.find(".tablesorter-header-inner").html(o[c]),k&&m.length&&m.eq(c).find(".tablesorter-header-inner").html(o[c])),l.eq(c).html(o[c])}))}s.showProcessing&&b.isProcessing(d),e.totalPages=Math.ceil(e.totalRows/(e.size||e.settings.size||10)),e.last.totalRows=e.totalRows,e.last.currentFilters=e.currentFilters,e.last.sortList=(s.sortList||[]).join(","),g(d,e,!1),t.trigger("updateCache",[function(){e.initialized&&setTimeout(function(){s.debug&&b.log("Pager: Triggering pagerChange"),t.trigger("applyWidgets").trigger("pagerChange",e),g(d,e,!0)},0)}])}e.initialized||(e.initialized=!0,e.initializing=!1,d.config.debug&&b.log("Pager: Triggering pagerInitialized"),a(d).trigger("applyWidgets").trigger("pagerInitialized",e),g(d,e))},n=function(c,d){var e,f=o(c,d),g=a(document),h=c.config;""!==f&&(h.showProcessing&&b.isProcessing(c,!0),g.bind("ajaxError.pager",function(a,b,e,f){m(null,c,d,b,f),g.unbind("ajaxError.pager")}),e=++d.ajaxCounter,d.last.ajaxUrl=f,d.ajaxObject.url=f,d.ajaxObject.success=function(a,b,f){ee;e++)m.push(k+"["+i[e][0]+"]="+i[e][1]);h=h.replace(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/g,m.length?m.join("&"):k),m=[]}if(l){for(l=l[1],f=j.length,e=0;f>e;e++)j[e]&&m.push(l+"["+e+"]="+encodeURIComponent(j[e]));h=h.replace(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/g,m.length?m.join("&"):l),d.currentFilters=j}return"function"==typeof d.customAjaxUrl&&(h=d.customAjaxUrl(c,h)),g.debug&&b.log("Pager: Ajax url = "+h),h},p=function(c,d,e){var f,h,i,j,l=a(c),m=c.config,n=m.$table.hasClass("hasFilters"),o=d&&d.length||0,p=e.page*e.size,q=e.size;if(1>o)return void(m.debug&&b.log("Pager: >> No rows for pager to render"));if(e.page>=e.totalPages&&v(c,e),e.cacheIndex=[],e.isDisabled=!1,e.initialized&&(m.debug&&b.log("Pager: Triggering pagerChange"),l.trigger("pagerChange",e)),e.removeRows){for(b.clearTableBody(c),f=b.processTbody(c,m.$tbodies.eq(0),!0),h=n?0:p,i=n?0:p,j=0;q>j&&hp&&q>=j&&(j++,e.cacheIndex.push(h),f.append(d[h]))),h++;b.processTbody(c,f,!1)}else k(c,e);g(c,e),c.isUpdating&&(m.debug&&b.log("Pager: Triggering updateComplete"),l.trigger("updateComplete",[c,!0]))},q=function(c,d){d.ajax?e(d,!0):(d.isDisabled=!0,a.data(c,"pagerLastPage",d.page),a.data(c,"pagerLastSize",d.size),d.page=0,d.size=d.totalRows,d.totalPages=1,a(c).addClass("pagerDisabled").removeAttr("aria-describedby").find("tr.pagerSavedHeightSpacer").remove(),p(c,c.config.rowsCopy,d),a(c).trigger("applyWidgets"),c.config.debug&&b.log("Pager: Disabled")),d.$size.add(d.$goto).add(d.$container.find(".ts-startRow, .ts-page")).each(function(){a(this).attr("aria-disabled","true").addClass(d.cssDisabled)[0].disabled=!0})},r=function(a){var b=a.config,c=b.pager;b.$table.trigger("updateCache",[function(){var d,e=[],f=a.config.cache[0].normalized;for(c.totalRows=f.length,d=0;dg-1&&0!==g&&(d.page=g-1),j.currentFilters=""===(j.currentFilters||[]).join("")?[]:j.currentFilters,d.currentFilters=""===(d.currentFilters||[]).join("")?[]:d.currentFilters,(j.page!==d.page||j.size!==d.size||j.totalRows!==d.totalRows||(j.currentFilters||[]).join(",")!==(d.currentFilters||[]).join(",")||(j.ajaxUrl||"")!==(d.ajaxObject.url||"")||(j.optAjaxUrl||"")!==(d.ajaxUrl||"")||j.sortList!==(h.sortList||[]).join(","))&&(h.debug&&b.log("Pager: Changing to page "+d.page),d.last={page:d.page,size:d.size,sortList:(h.sortList||[]).join(","),totalRows:d.totalRows,currentFilters:d.currentFilters||[],ajaxUrl:d.ajaxObject.url||"",optAjaxUrl:d.ajaxUrl||""},d.ajax?n(c,d):d.ajax||p(c,h.rowsCopy,d),a.data(c,"pagerLastPage",d.page),d.initialized&&e!==!1&&(h.debug&&b.log("Pager: Triggering pageMoved"),i.trigger("pageMoved",d).trigger("applyWidgets"),c.isUpdating&&(h.debug&&b.log("Pager: Triggering updateComplete"),i.trigger("updateComplete",[c,!0]))))))}},t=function(b,c,d){d.size=c||d.size||d.settings.size||10,d.$size.val(d.size),a.data(b,"pagerLastPage",d.page),a.data(b,"pagerLastSize",d.size),d.totalPages=Math.ceil(d.totalRows/d.size),d.filteredPages=Math.ceil(d.filteredRows/d.size),s(b,d)},u=function(a,b){b.page=0,s(a,b)},v=function(a,b){b.page=Math.min(b.totalPages,b.filteredPages)-1,s(a,b)},w=function(a,b){b.page++,b.page>=Math.min(b.totalPages,b.filteredPages)-1&&(b.page=Math.min(b.totalPages,b.filteredPages)-1),s(a,b)},x=function(a,b){b.page--,b.page<=0&&(b.page=0),s(a,b)},y=function(d,e){q(d,e),e.$container.hide(),d.config.appender=null,e.initialized=!1,delete d.config.rowsCopy,a(d).unbind(c.split(" ").join(".pager ").replace(/\s+/g," ")),b.storage&&b.storage(d,e.storageKey,"")},z=function(c,d,e){var f,g=c.config;d.$size.add(d.$goto).add(d.$container.find(".ts-startRow, .ts-page")).removeClass(d.cssDisabled).removeAttr("disabled").attr("aria-disabled","false"),d.isDisabled=!1,d.page=a.data(c,"pagerLastPage")||d.page||0,d.size=a.data(c,"pagerLastSize")||parseInt(d.$size.find("option[selected]").val(),10)||d.size||d.settings.size||10,d.$size.val(d.size),d.totalPages=Math.ceil(Math.min(d.totalRows,d.filteredRows)/d.size),c.id&&(f=c.id+"_pager_info",d.$container.find(d.cssPageDisplay).attr("id",f),g.$table.attr("aria-describedby",f)),j(c,d),e&&(g.$table.trigger("updateRows"),t(c,d.size,d),l(c,d),g.debug&&b.log("Pager: Enabled"))};d.appender=function(b,c){var d=b.config,e=d.pager;e.ajax||(d.rowsCopy=c,e.totalRows=e.countChildRows?d.$tbodies.eq(0).children("tr").length:c.length,e.size=a.data(b,"pagerLastSize")||e.size||e.settings.size||10,e.totalPages=Math.ceil(e.totalRows/e.size),p(b,c,e),g(b,e,!1))},d.construct=function(e){return this.each(function(){if(this.config&&this.hasInitialized){var f,h,i,m=this,n=m.config,o=n.widgetOptions,p=n.pager=a.extend(!0,{},a.tablesorterPager.defaults,e),A=n.$table,B=p.$container=a(p.container).addClass("tablesorter-pager").show();p.settings=a.extend(!0,{},a.tablesorterPager.defaults,e),n.debug&&b.log("Pager: Initializing"),p.oldAjaxSuccess=p.oldAjaxSuccess||p.ajaxObject.success,n.appender=d.appender,p.initializing=!0,p.savePages&&b.storage&&(f=b.storage(m,p.storageKey)||{},p.page=isNaN(f.page)?p.page:f.page,p.size=(isNaN(f.size)?p.size:f.size)||p.settings.size||10,a.data(m,"pagerLastSize",p.size)),p.regexRows=new RegExp("("+(o.filter_filteredRow||"filtered")+"|"+n.selectorRemove.slice(1)+"|"+n.cssChildRow+")"),A.unbind(c.split(" ").join(".pager ").replace(/\s+/g," ")).bind("filterInit.pager filterStart.pager",function(b,c){p.currentFilters=a.isArray(c)?c:n.$table.data("lastSearch"),"filterStart"===b.type&&p.pageReset!==!1&&(n.lastCombinedFilter||"")!==(p.currentFilters||[]).join("")&&(p.page=p.pageReset)}).bind("filterEnd.pager sortEnd.pager",function(){p.currentFilters=n.$table.data("lastSearch"),(p.initialized||p.initializing)&&(n.delayInit&&n.rowsCopy&&0===n.rowsCopy.length&&r(m),g(m,p,!1),s(m,p,!1),n.$table.trigger("applyWidgets"))}).bind("disable.pager",function(a){a.stopPropagation(),q(m,p)}).bind("enable.pager",function(a){a.stopPropagation(),z(m,p,!0)}).bind("destroy.pager",function(a){a.stopPropagation(),y(m,p)}).bind("updateComplete.pager",function(a,b,c){if(a.stopPropagation(),b&&!c&&!p.ajax){var d=n.$tbodies.eq(0).children("tr").not(n.selectorRemove);p.totalRows=d.length-(p.countChildRows?0:d.filter("."+n.cssChildRow).length),p.totalPages=Math.ceil(p.totalRows/p.size),d.length&&n.rowsCopy&&0===n.rowsCopy.length&&r(b),p.page>=p.totalPages&&v(b,p),k(b,p),j(b,p),g(b,p,!0)}}).bind("pageSize.pager refreshComplete.pager",function(a,b){a.stopPropagation(),t(m,parseInt(b,10)||p.settings.size||10,p),k(m,p),g(m,p,!1)}).bind("pageSet.pager pagerUpdate.pager",function(a,b){a.stopPropagation(),p.page=(parseInt(b,10)||1)-1,"pagerUpdate"===a.type&&(p.last.page=!0),s(m,p,!0),g(m,p,!1)}).bind("pageAndSize.pager",function(a,b,c){a.stopPropagation(),p.page=(parseInt(b,10)||1)-1,t(m,parseInt(c,10)||p.settings.size||10,p),s(m,p,!0),k(m,p),g(m,p,!1)}),h=[p.cssFirst,p.cssPrev,p.cssNext,p.cssLast],i=[u,x,w,v],n.debug&&!B.length&&b.log("Pager: >> Container not found"),B.find(h.join(",")).attr("tabindex",0).unbind("click.pager").bind("click.pager",function(b){b.stopPropagation();var c,d=a(this),e=h.length;if(!d.hasClass(p.cssDisabled))for(c=0;e>c;c++)if(d.is(h[c])){i[c](m,p);break}}),p.$goto=B.find(p.cssGoto),p.$goto.length?p.$goto.unbind("change.pager").bind("change.pager",function(){p.page=a(this).val()-1,s(m,p,!0),g(m,p,!1)}):n.debug&&b.log("Pager: >> Goto selector not found"),p.$size=B.find(p.cssPageSize),p.$size.length?(p.$size.find("option").removeAttr("selected"),p.$size.unbind("change.pager").bind("change.pager",function(){return p.$size.val(a(this).val()),a(this).hasClass(p.cssDisabled)||(t(m,parseInt(a(this).val(),10),p),j(m,p)),!1})):n.debug&&b.log("Pager: >> Size selector not found"),p.initialized=!1,A.trigger("pagerBeforeInitialized",p),z(m,p,!1),"string"==typeof p.ajaxUrl?(p.ajax=!0,n.widgetOptions.filter_serversideFiltering=!0,n.serverSideSorting=!0,s(m,p)):(p.ajax=!1,a(this).trigger("appendCache",!0),l(m,p)),p.ajax||p.initialized||(p.initializing=!1,p.initialized=!0,s(m,p),n.debug&&b.log("Pager: Triggering pagerInitialized"),n.$table.trigger("pagerInitialized",p),n.widgetOptions.filter_initialized&&b.hasWidget(m,"filter")||g(m,p,!1))}})}}}),b.showError=function(b,c){a(b).each(function(){var b,d=this.config,e=d.pager&&d.pager.cssErrorRow||d.widgetOptions.pager_css&&d.widgetOptions.pager_css.errorRow||"tablesorter-errorRow";d&&("undefined"==typeof c?d.$table.find("thead").find(d.selectorRemove).remove():b=a(/tr\>/.test(c)?c:''+c+"").click(function(){a(this).remove()}).appendTo(d.$table.find("thead:first")).addClass(e+" "+d.selectorRemove.slice(1)).attr({role:"alert","aria-live":"assertive"}))})},a.fn.extend({tablesorterPager:a.tablesorterPager.construct})}(jQuery),function(a){var b=a.tablesorter;a.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(a,b){return b},ajaxObject:{dataType:"json"},processAjaxOnInit:!0,ajaxProcessing:function(){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,pageReset:0,size:10,maxOptionSize:20,savePages:!0,storageKey:"tablesorter-pager",fixedHeight:!1,countChildRows:!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,ajaxCounter:0,currentFilters:[],startRow:0,endRow:0,$size:null,last:{}};var c=this,d=function(a,b){var c=a.cssDisabled,d=!!b,e=d||0===a.page,f=Math.min(a.totalPages,a.filteredPages),d=d||a.page===f-1||0===f;a.updateArrows&&(a.$container.find(a.cssFirst+","+a.cssPrev)[e?"addClass":"removeClass"](c).attr("aria-disabled",e),a.$container.find(a.cssNext+","+a.cssLast)[d?"addClass":"removeClass"](c).attr("aria-disabled",d))},e=function(b,c){var d,e=b.config;(d=e.$table.hasClass("hasFilters"))&&!c.ajaxUrl?a.isEmptyObject(e.cache)?c.filteredRows=c.totalRows=e.$tbodies.eq(0).children("tr").not(c.countChildRows?"":"."+e.cssChildRow).length:(d=e.$table.children("tbody").index(e.$tbodies.eq(0)),c.filteredRows=0,a.each(e.cache[d].normalized,function(a,b){c.filteredRows+=c.regexRows.test(b[e.columns].$row[0].className)?0:1})):d||(c.filteredRows=c.totalRows)},f=function(c,f,i){if(!f.initializing){var j,k,l,m=c.config;j=f.size||f.settings.size||10,f.countChildRows&&k.push(m.cssChildRow),f.totalPages=Math.ceil(f.totalRows/j),m.totalRows=f.totalRows,e(c,f),m.filteredRows=f.filteredRows,f.filteredPages=Math.ceil(f.filteredRows/j)||0,0<=Math.min(f.totalPages,f.filteredPages)&&(k=f.size*f.page>f.filteredRows&&i,f.page=k?f.pageReset||0:f.page,f.startRow=k?f.size*f.page+1:0===f.filteredRows?0:f.size*f.page+1,f.endRow=Math.min(f.filteredRows,f.totalRows,f.size*(f.page+1)),l=f.$container.find(f.cssPageDisplay),j=(f.ajaxData&&f.ajaxData.output?f.ajaxData.output||f.output:f.output).replace(/\{page([\-+]\d+)?\}/gi,function(a,b){return f.totalPages?f.page+(b?parseInt(b,10):1):0}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(a){var b,c;b=a.replace(/[{}\s]/g,""),a=b.split(":"),c=f.ajaxData;var d=/(rows?|pages?)$/i.test(b)?0:"";return/(startRow|page)/.test(a[0])&&"input"===a[1]?(b=(""+("page"===a[0]?f.totalPages:f.totalRows)).length,c="page"===a[0]?f.page+1:f.startRow,''):1'+b+""}),f.$goto.html(k).val(f.page+1)),l.length&&(l["INPUT"===l[0].tagName?"val":"html"](j),l.find(".ts-startRow, .ts-page").unbind("change.pager").bind("change.pager",function(){var b=a(this).val(),b=a(this).hasClass("ts-startRow")?Math.floor(b/f.size)+1:b;m.$table.trigger("pageSet.pager",[b])}))),d(f),h(c,f),f.initialized&&!1!==i&&(m.$table.trigger("pagerComplete",f),f.savePages&&b.storage&&b.storage(c,f.storageKey,{page:f.page,size:f.size}))}},g=function(b){var c,d,e,f,g;g=Math.min(b.totalPages,b.filteredPages)||1;var h=5*Math.ceil(g/b.maxOptionSize/5);e=g>b.maxOptionSize,f=b.page+1,c=h,d=g-h;var i=[1];for(c=e?h:1;g>=c;)i.push(c),c+=e?h:1;if(i.push(g),e){for(e=[],d=Math.max(Math.floor(b.maxOptionSize/h)-1,5),c=f-d,1>c&&(c=1),d=f+d,d>g&&(d=g);d>=c;c++)e.push(c);i=a.grep(i,function(b,c){return a.inArray(b,i)===c}),f=i.length,g=e.length,f-g>h/2&&f+g>b.maxOptionSize&&(b=Math.floor(f/2)-Math.floor(g/2),Array.prototype.splice.apply(i,[b,g])),i=i.concat(e)}return i=a.grep(i,function(b,c){return a.inArray(b,i)===c}).sort(function(a,b){return a-b})},h=function(b,c){var d,e=b.config,f=e.$tbodies.eq(0);f.find("tr.pagerSavedHeightSpacer").remove(),c.fixedHeight&&!c.isDisabled&&(d=a.data(b,"pagerSavedHeight"))&&(d-=f.height(),d>5&&a.data(b,"pagerLastSize")===c.size&&f.children("tr:visible").length'))},i=function(b,c){var d;d=b.config;var e=d.$tbodies.eq(0);e.find("tr.pagerSavedHeightSpacer").remove(),e.children("tr:visible").length||e.append(' '),d=e.children("tr").eq(0).height()*c.size,a.data(b,"pagerSavedHeight",d),h(b,c),a.data(b,"pagerLastSize",c.size)},j=function(a,c){if(!c.ajaxUrl){var d,e=0,f=a.config,g=f.$tbodies.eq(0).children("tr"),h=g.length,i=c.page*c.size,j=i+c.size,k=f.widgetOptions&&f.widgetOptions.filter_filteredRow||"filtered",l=0,m=0;for(c.cacheIndex=[],d=0;h>d;d++)g[d].className.match(k)||(m===i&&g[d].className.match(f.cssChildRow)?g[d].style.display="none":(g[d].style.display=m>=i&&j>m?"":"none",l!==m&&m>=i&&j>m&&(c.cacheIndex.push(d),l=m),m+=g[d].className.match(f.cssChildRow+"|"+f.selectorRemove.slice(1))&&!c.countChildRows?0:1,m===j&&"none"!==g[d].style.display&&g[d].className.match(b.css.cssHasChild)&&(e=d)));if(e>0&&g[e].className.match(b.css.cssHasChild))for(;++ei;i++){for(q+="",h=0;h"+g[i][h]+"";q+=""}e.processAjaxOnInit&&o.$tbodies.eq(0).html(q)}e.processAjaxOnInit=!0,m&&m.length===c&&(l=(j=p.hasClass("hasStickyHeaders"))?o.widgetOptions.$sticky.children("thead:first").children("tr").children():"",k=p.find("tfoot tr:first").children(),o.$headers.filter("th").each(function(c){var d,e=a(this);e.find("."+b.css.icon).length?(d=e.find("."+b.css.icon).clone(!0),e.find(".tablesorter-header-inner").html(m[c]).append(d),j&&l.length&&(d=l.eq(c).find("."+b.css.icon).clone(!0),l.eq(c).find(".tablesorter-header-inner").html(m[c]).append(d))):(e.find(".tablesorter-header-inner").html(m[c]),j&&l.length&&l.eq(c).find(".tablesorter-header-inner").html(m[c])),k.eq(c).html(m[c])}))}o.showProcessing&&b.isProcessing(d),e.totalPages=Math.ceil(e.totalRows/(e.size||e.settings.size||10)),e.last.totalRows=e.totalRows,e.last.currentFilters=e.currentFilters,e.last.sortList=(o.sortList||[]).join(","),f(d,e,!1),p.trigger("updateCache",[function(){e.initialized&&setTimeout(function(){p.trigger("applyWidgets").trigger("pagerChange",e),f(d,e,!0)},0)}])}e.initialized||(e.initialized=!0,e.initializing=!1,a(d).trigger("applyWidgets").trigger("pagerInitialized",e),f(d,e))},m=function(c,d){var e,f=n(c,d),g=a(document),h=c.config;""!==f&&(h.showProcessing&&b.isProcessing(c,!0),g.bind("ajaxError.pager",function(a,b,e,f){l(null,c,d,b,f),g.unbind("ajaxError.pager")}),e=++d.ajaxCounter,d.last.ajaxUrl=f,d.ajaxObject.url=f,d.ajaxObject.success=function(a,b,f){e(d&&d.length||0))g.debug&&b.log("Pager: no rows for pager to render");else{if(e.page>=e.totalPages&&u(c,e),e.cacheIndex=[],e.isDisabled=!1,e.initialized&&l.trigger("pagerChange",e),e.removeRows){for(b.clearTableBody(c),g=b.processTbody(c,g.$tbodies.eq(0),!0),h=m?0:n,i=m?0:n,k=0;o>k&&hn&&o>=k&&(k++,e.cacheIndex.push(h),g.append(d[h]))),h++;b.processTbody(c,g,!1)}else j(c,e);f(c,e),c.isUpdating&&l.trigger("updateComplete",[c,!0])}},p=function(c,e){e.ajax?d(e,!0):(e.isDisabled=!0,a.data(c,"pagerLastPage",e.page),a.data(c,"pagerLastSize",e.size),e.page=0,e.size=e.totalRows,e.totalPages=1,a(c).addClass("pagerDisabled").removeAttr("aria-describedby").find("tr.pagerSavedHeightSpacer").remove(),o(c,c.config.rowsCopy,e),a(c).trigger("applyWidgets"),c.config.debug&&b.log("pager disabled")),e.$size.add(e.$goto).add(e.$container.find(".ts-startRow, .ts-page")).each(function(){a(this).attr("aria-disabled","true").addClass(e.cssDisabled)[0].disabled=!0})},q=function(a){var b=a.config,c=b.pager;b.$table.trigger("updateCache",[function(){var d,e=[];d=b.$table.children("tbody").index(b.$tbodies.eq(0));var f=a.config.cache[d].normalized;for(c.totalRows=f.length,d=0;dd.page&&(d.page=0),d.page>g-1&&0!==g&&(d.page=g-1),j.currentFilters=""===(j.currentFilters||[]).join("")?[]:j.currentFilters,d.currentFilters=""===(d.currentFilters||[]).join("")?[]:d.currentFilters,(j.page!==d.page||j.size!==d.size||j.totalRows!==d.totalRows||(j.currentFilters||[]).join(",")!==(d.currentFilters||[]).join(",")||(j.ajaxUrl||"")!==(d.ajaxObject.url||"")||(j.optAjaxUrl||"")!==(d.ajaxUrl||"")||j.sortList!==(h.sortList||[]).join(","))&&(h.debug&&b.log("Pager changing to page "+d.page),d.last={page:d.page,size:d.size,sortList:(h.sortList||[]).join(","),totalRows:d.totalRows,currentFilters:d.currentFilters||[],ajaxUrl:d.ajaxObject.url||"",optAjaxUrl:d.ajaxUrl||""},d.ajax?m(c,d):d.ajax||o(c,h.rowsCopy,d),a.data(c,"pagerLastPage",d.page),d.initialized&&!1!==f&&(i.trigger("pageMoved",d).trigger("applyWidgets"),c.isUpdating&&i.trigger("updateComplete",[c,!0]))))}},s=function(b,c,d){d.size=c||d.size||d.settings.size||10,d.$size.val(d.size),a.data(b,"pagerLastPage",d.page),a.data(b,"pagerLastSize",d.size),d.totalPages=Math.ceil(d.totalRows/d.size),d.filteredPages=Math.ceil(d.filteredRows/d.size),r(b,d)},t=function(a,b){b.page=0,r(a,b)},u=function(a,b){b.page=Math.min(b.totalPages,b.filteredPages)-1,r(a,b)},v=function(a,b){b.page++,b.page>=Math.min(b.totalPages,b.filteredPages)-1&&(b.page=Math.min(b.totalPages,b.filteredPages)-1),r(a,b)},w=function(a,b){b.page--,0>=b.page&&(b.page=0),r(a,b)},x=function(c,d,e){var f,g=c.config;d.$size.add(d.$goto).add(d.$container.find(".ts-startRow, .ts-page")).removeClass(d.cssDisabled).removeAttr("disabled").attr("aria-disabled","false"),d.isDisabled=!1,d.page=a.data(c,"pagerLastPage")||d.page||0,d.size=a.data(c,"pagerLastSize")||parseInt(d.$size.find("option[selected]").val(),10)||d.size||d.settings.size||10,d.$size.val(d.size),d.totalPages=Math.ceil(Math.min(d.totalRows,d.filteredRows)/d.size),c.id&&(f=c.id+"_pager_info",d.$container.find(d.cssPageDisplay).attr("id",f),g.$table.attr("aria-describedby",f)),i(c,d),e&&(g.$table.trigger("updateRows"),s(c,d.size,d),k(c,d),g.debug&&b.log("pager enabled"))};c.appender=function(b,c){var d=b.config,e=d.pager;e.ajax||(d.rowsCopy=c,e.totalRows=e.countChildRows?d.$tbodies.eq(0).children("tr").length:c.length,e.size=a.data(b,"pagerLastSize")||e.size||e.settings.size||10,e.totalPages=Math.ceil(e.totalRows/e.size),o(b,c,e),f(b,e,!1))},c.construct=function(d){return this.each(function(){if(this.config&&this.hasInitialized){var e,g,h,l=this,m=l.config,n=m.widgetOptions,o=m.pager=a.extend(!0,{},a.tablesorterPager.defaults,d),y=m.$table,z=o.$container=a(o.container).addClass("tablesorter-pager").show();o.settings=a.extend(!0,{},a.tablesorterPager.defaults,d),m.debug&&b.log("Pager initializing"),o.oldAjaxSuccess=o.oldAjaxSuccess||o.ajaxObject.success,m.appender=c.appender,o.initializing=!0,o.savePages&&b.storage&&(e=b.storage(l,o.storageKey)||{},o.page=isNaN(e.page)?o.page:e.page,o.size=(isNaN(e.size)?o.size:e.size)||o.settings.size||10,a.data(l,"pagerLastSize",o.size)),o.regexRows=new RegExp("("+(n.filter_filteredRow||"filtered")+"|"+m.selectorRemove.slice(1)+"|"+m.cssChildRow+")"),y.unbind(a.trim("filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet pageAndSize pagerUpdate ".split(" ").join(".pager "))).bind("filterInit.pager filterStart.pager",function(b,c){o.currentFilters=a.isArray(c)?c:m.$table.data("lastSearch"),"filterStart"===b.type&&!1!==o.pageReset&&(m.lastCombinedFilter||"")!==(o.currentFilters||[]).join("")&&(o.page=o.pageReset) }).bind("filterEnd.pager sortEnd.pager",function(){o.currentFilters=m.$table.data("lastSearch"),(o.initialized||o.initializing)&&(m.delayInit&&m.rowsCopy&&0===m.rowsCopy.length&&q(l),f(l,o,!1),r(l,o,!1),m.$table.trigger("applyWidgets"))}).bind("disable.pager",function(a){a.stopPropagation(),p(l,o)}).bind("enable.pager",function(a){a.stopPropagation(),x(l,o,!0)}).bind("destroy.pager",function(c){c.stopPropagation(),p(l,o),o.$container.hide(),l.config.appender=null,o.initialized=!1,delete l.config.rowsCopy,a(l).unbind(a.trim("filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet pageAndSize pagerUpdate ".split(" ").join(".pager "))),b.storage&&b.storage(l,o.storageKey,"")}).bind("updateComplete.pager",function(a,b,c){a.stopPropagation(),b&&!c&&(a=m.$tbodies.eq(0).children("tr").not(m.selectorRemove),o.totalRows=a.length-(o.countChildRows?0:a.filter("."+m.cssChildRow).length),o.totalPages=Math.ceil(o.totalRows/o.size),a.length&&m.rowsCopy&&0===m.rowsCopy.length&&q(b),o.page>=o.totalPages&&u(b,o),j(b,o),i(b,o),f(b,o,!0))}).bind("pageSize.pager refreshComplete.pager",function(a,b){a.stopPropagation(),s(l,parseInt(b,10)||o.settings.size||10,o),j(l,o),f(l,o,!1)}).bind("pageSet.pager pagerUpdate.pager",function(a,b){a.stopPropagation(),o.page=(parseInt(b,10)||1)-1,"pagerUpdate"===a.type&&(o.last.page=!0),r(l,o,!0),f(l,o,!1)}).bind("pageAndSize.pager",function(a,b,c){a.stopPropagation(),o.page=(parseInt(b,10)||1)-1,s(l,parseInt(c,10)||o.settings.size||10,o),r(l,o,!0),j(l,o),f(l,o,!1)}),g=[o.cssFirst,o.cssPrev,o.cssNext,o.cssLast],h=[t,w,v,u],z.find(g.join(",")).attr("tabindex",0).unbind("click.pager").bind("click.pager",function(b){b.stopPropagation();var c=a(this),d=g.length;if(!c.hasClass(o.cssDisabled))for(b=0;d>b;b++)if(c.is(g[b])){h[b](l,o);break}}),o.$goto=z.find(o.cssGoto),o.$goto.length&&o.$goto.unbind("change.pager").bind("change.pager",function(){o.page=a(this).val()-1,r(l,o,!0),f(l,o,!1)}),o.$size=z.find(o.cssPageSize),o.$size.length&&(o.$size.find("option").removeAttr("selected"),o.$size.unbind("change.pager").bind("change.pager",function(){return o.$size.val(a(this).val()),a(this).hasClass(o.cssDisabled)||(s(l,parseInt(a(this).val(),10),o),i(l,o)),!1})),o.initialized=!1,y.trigger("pagerBeforeInitialized",o),x(l,o,!1),"string"==typeof o.ajaxUrl?(o.ajax=!0,m.widgetOptions.filter_serversideFiltering=!0,m.serverSideSorting=!0,r(l,o)):(o.ajax=!1,a(this).trigger("appendCache",!0),k(l,o)),o.ajax||o.initialized||(o.initializing=!1,o.initialized=!0,r(l,o),a(l).trigger("pagerInitialized",o),m.widgetOptions.filter_initialized&&b.hasWidget(l,"filter")||f(l,o,!1))}})}}}),b.showError=function(b,c){a(b).each(function(){var b=this.config,d=b.pager&&b.pager.cssErrorRow||b.widgetOptions.pager_css&&b.widgetOptions.pager_css.errorRow||"tablesorter-errorRow";b&&("undefined"==typeof c?b.$table.find("thead").find(b.selectorRemove).remove():a(/tr\>/.test(c)?c:''+c+"").click(function(){a(this).remove()}).appendTo(b.$table.find("thead:first")).addClass(d+" "+b.selectorRemove.slice(1)).attr({role:"alert","aria-live":"assertive"}))})},a.fn.extend({tablesorterPager:a.tablesorterPager.construct})}(jQuery); \ No newline at end of file diff --git a/dist/js/widgets/widget-pager.min.js b/dist/js/widgets/widget-pager.min.js index 2d3fde4a..aeafe714 100644 --- a/dist/js/widgets/widget-pager.min.js +++ b/dist/js/widgets/widget-pager.min.js @@ -1 +1 @@ -!function(a){"use strict";var b,c=a.tablesorter;c.addWidget({id:"pager",priority:55,options:{pager_output:"{startRow} to {endRow} of {totalRows} rows",pager_updateArrows:!0,pager_startPage:0,pager_pageReset:0,pager_size:10,pager_maxOptionSize:20,pager_savePages:!0,pager_storageKey:"tablesorter-pager",pager_fixedHeight:!1,pager_countChildRows:!1,pager_removeRows:!1,pager_ajaxUrl:null,pager_customAjaxUrl:function(a,b){return b},pager_ajaxObject:{dataType:"json"},pager_processAjaxOnInit:!0,pager_ajaxProcessing:function(){return[0,[],null]},pager_css:{container:"tablesorter-pager",errorRow:"tablesorter-errorRow",disabled:"disabled"},pager_selectors:{container:".pager",first:".first",prev:".prev",next:".next",last:".last",gotoPage:".gotoPage",pageDisplay:".pagedisplay",pageSize:".pagesize"}},init:function(a){b.init(a)},format:function(a,c){return c.pager&&c.pager.initialized?void b.moveToPage(a,c.pager,!1):b.initComplete(a,c)},remove:function(a,c,d,e){b.destroyPager(a,c,e)}}),b=c.pager={init:function(d){if(!d.hasInitialized||!d.config.pager.initialized){var e,f=d.config,g=f.widgetOptions,h=g.pager_selectors,i=f.pager=a.extend({totalPages:0,filteredRows:0,filteredPages:0,currentFilters:[],page:g.pager_startPage,startRow:0,endRow:0,ajaxCounter:0,$size:null,last:{},setSize:g.pager_size,setPage:g.pager_startPage,events:"filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet pageAndSize pagerUpdate "},f.pager);i.isInitializing||(i.isInitializing=!0,f.debug&&c.log("Pager: Initializing"),i.size=a.data(d,"pagerLastSize")||g.pager_size,i.$container=a(h.container).addClass(g.pager_css.container).show(),i.$goto=i.$container.find(h.gotoPage),i.$size=i.$container.find(h.pageSize),i.totalRows=f.$tbodies.eq(0).children("tr").not(g.pager_countChildRows?"":"."+f.cssChildRow).length,i.oldAjaxSuccess=i.oldAjaxSuccess||g.pager_ajaxObject.success,f.appender=b.appender,i.initializing=!0,g.pager_savePages&&c.storage&&(e=c.storage(d,g.pager_storageKey)||{},i.page=(isNaN(e.page)?i.page:e.page)||i.setPage||0,i.size=(isNaN(e.size)?i.size:e.size)||i.setSize||10,a.data(d,"pagerLastSize",i.size)),i.regexRows=new RegExp("("+(g.filter_filteredRow||"filtered")+"|"+f.selectorRemove.slice(1)+"|"+f.cssChildRow+")"),i.initialized=!1,f.$table.trigger("pagerBeforeInitialized",f),b.enablePager(d,f,!1),i.ajaxObject=g.pager_ajaxObject,i.ajaxObject.url=g.pager_ajaxUrl,"string"==typeof g.pager_ajaxUrl?(i.ajax=!0,g.filter_serversideFiltering=!0,f.serverSideSorting=!0,b.moveToPage(d,i)):(i.ajax=!1,f.$table.trigger("appendCache",[{},!0])))}},initComplete:function(a,d){var e=d.pager;b.bindEvents(a,d),b.setPageSize(a,0,d),e.ajax||b.hideRowsSetup(a,d),e.initialized=!0,e.initializing=!1,e.isInitializing=!1,d.debug&&c.log("Pager: Triggering pagerInitialized"),d.$table.trigger("pagerInitialized",d),d.widgetOptions.filter_initialized&&c.hasWidget(a,"filter")||b.updatePageDisplay(a,d,!e.ajax)},bindEvents:function(d,e){var f,g,h=e.pager,i=e.widgetOptions,j=i.pager_selectors;e.$table.off(a.trim(h.events.split(" ").join(".pager "))).on("filterInit.pager filterStart.pager",function(b,c){h.currentFilters=a.isArray(c)?c:e.$table.data("lastSearch"),"filterStart"===b.type&&i.pager_pageReset!==!1&&(e.lastCombinedFilter||"")!==(h.currentFilters||[]).join("")&&(h.page=i.pager_pageReset)}).on("filterEnd.pager sortEnd.pager",function(){h.currentFilters=e.$table.data("lastSearch"),(h.initialized||h.initializing)&&(e.delayInit&&e.rowsCopy&&0===e.rowsCopy.length&&b.updateCache(d),b.updatePageDisplay(d,e,!1),e.$table.trigger("applyWidgets"))}).on("disable.pager",function(a){a.stopPropagation(),b.showAllRows(d,e)}).on("enable.pager",function(a){a.stopPropagation(),b.enablePager(d,e,!0)}).on("destroy.pager",function(a,c){a.stopPropagation(),b.destroyPager(d,e,c)}).on("updateComplete.pager",function(a,c,d){if(a.stopPropagation(),c&&!d){var f=e.$tbodies.eq(0).children("tr").not(e.selectorRemove);h.totalRows=f.length-(i.pager_countChildRows?0:f.filter("."+e.cssChildRow).length),h.totalPages=Math.ceil(h.totalRows/h.size),f.length&&e.rowsCopy&&0===e.rowsCopy.length&&b.updateCache(c),h.page>=h.totalPages&&b.moveToLastPage(c,h),b.hideRows(c,e),b.changeHeight(c,e),b.updatePageDisplay(c,e,!1),e.$table.trigger("applyWidgets"),b.updatePageDisplay(c,e)}}).on("pageSize.pager refreshComplete.pager",function(a,c){a.stopPropagation(),b.setPageSize(d,parseInt(c,10)||h.setSize||10,e),b.hideRows(d,e),b.updatePageDisplay(d,e,!1)}).on("pageSet.pager pagerUpdate.pager",function(a,c){a.stopPropagation(),h.page=(parseInt(c,10)||1)-1,"pagerUpdate"===a.type&&(h.last.page=!0),b.moveToPage(d,h,!0),b.updatePageDisplay(d,e,!1)}).on("pageAndSize.pager",function(a,c,f){a.stopPropagation(),h.page=(parseInt(c,10)||1)-1,b.setPageSize(d,parseInt(f,10)||h.setSize||10,e),b.moveToPage(d,h,!0),b.hideRows(d,e),b.updatePageDisplay(d,e,!1)}),f=[j.first,j.prev,j.next,j.last],g=["moveToFirstPage","moveToPrevPage","moveToNextPage","moveToLastPage"],e.debug&&!h.$container.length&&c.log("Pager: >> Container not found"),h.$container.find(f.join(",")).attr("tabindex",0).off("click.pager").on("click.pager",function(c){c.stopPropagation();var e,j=a(this),k=f.length;if(!j.hasClass(i.pager_css.disabled))for(e=0;k>e;e++)if(j.is(f[e])){b[g[e]](d,h);break}}),h.$goto.length?h.$goto.off("change.pager").on("change.pager",function(){h.page=a(this).val()-1,b.moveToPage(d,h,!0),b.updatePageDisplay(d,e,!1)}):e.debug&&c.log("Pager: >> Goto selector not found"),h.$size.length?(h.$size.find("option").removeAttr("selected"),h.$size.off("change.pager").on("change.pager",function(){return h.$size.val(a(this).val()),a(this).hasClass(i.pager_css.disabled)||(b.setPageSize(d,parseInt(a(this).val(),10),e),b.changeHeight(d,e)),!1})):e.debug&&c.log("Pager: >> Size selector not found")},pagerArrows:function(a,b){var c=a.pager,d=!!b,e=d||0===c.page,f=Math.min(c.totalPages,c.filteredPages),g=d||c.page===f-1||0===f,h=a.widgetOptions,i=h.pager_selectors;h.pager_updateArrows&&(c.$container.find(i.first+","+i.prev).toggleClass(h.pager_css.disabled,e).attr("aria-disabled",e),c.$container.find(i.next+","+i.last).toggleClass(h.pager_css.disabled,g).attr("aria-disabled",g))},calcFilters:function(b,c){var d,e,f,g=c.widgetOptions,h=c.pager,i=c.$table.hasClass("hasFilters");if(i&&!g.pager_ajaxUrl)if(a.isEmptyObject(c.cache))h.filteredRows=h.totalRows=c.$tbodies.eq(0).children("tr").not(g.pager_countChildRows?"":"."+c.cssChildRow).length;else for(h.filteredRows=0,d=c.cache[0].normalized,f=d.length,e=0;f>e;e++)h.filteredRows+=h.regexRows.test(d[e][c.columns].$row[0].className)?0:1;else i||(h.filteredRows=h.totalRows)},updatePageDisplay:function(d,e,f){if(!e.pager.initializing){var g,h,i,j,k,l,m=e.widgetOptions,n=e.pager,o=n.size||n.setSize||10;if(m.pager_countChildRows&&h.push(e.cssChildRow),n.$size.add(n.$goto).removeClass(m.pager_css.disabled).removeAttr("disabled").attr("aria-disabled","false"),n.totalPages=Math.ceil(n.totalRows/o),e.totalRows=n.totalRows,b.calcFilters(d,e),e.filteredRows=n.filteredRows,n.filteredPages=Math.ceil(n.filteredRows/o)||0,Math.min(n.totalPages,n.filteredPages)>=0){if(h=n.size*n.page>n.filteredRows&&f,n.page=h?m.pager_pageReset||0:n.page,n.startRow=h?n.size*n.page+1:0===n.filteredRows?0:n.size*n.page+1,n.endRow=Math.min(n.filteredRows,n.totalRows,n.size*(n.page+1)),i=n.$container.find(m.pager_selectors.pageDisplay),g=(n.ajaxData&&n.ajaxData.output?n.ajaxData.output||m.pager_output:m.pager_output).replace(/\{page([\-+]\d+)?\}/gi,function(a,b){return n.totalPages?n.page+(b?parseInt(b,10):1):0}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(a){var b,c,d=a.replace(/[{}\s]/g,""),e=d.split(":"),f=n.ajaxData,g=/(rows?|pages?)$/i.test(d)?0:"";return/(startRow|page)/.test(e[0])&&"input"===e[1]?(b=(""+("page"===e[0]?n.totalPages:n.totalRows)).length,c="page"===e[0]?n.page+1:n.startRow,''):e.length>1&&f&&f[e[0]]?f[e[0]][e[1]]:n[d]||(f?f[d]:g)||g}),n.$goto.length){for(h="",j=b.buildPageSelect(n,e),l=j.length,k=0;l>k;k++)h+='";n.$goto.html(h).val(n.page+1)}i.length&&(i["INPUT"===i[0].tagName?"val":"html"](g),i.find(".ts-startRow, .ts-page").off("change.pager").on("change.pager",function(){var b=a(this).val(),c=a(this).hasClass("ts-startRow")?Math.floor(b/n.size)+1:b;e.$table.trigger("pageSet.pager",[c])}))}b.pagerArrows(e),b.fixHeight(d,e),n.initialized&&f!==!1&&(e.debug&&c.log("Pager: Triggering pagerComplete"),e.$table.trigger("pagerComplete",e),m.pager_savePages&&c.storage&&c.storage(d,m.pager_storageKey,{page:n.page,size:n.size}))}},buildPageSelect:function(b,c){var d,e,f,g,h,i,j=c.widgetOptions,k=Math.min(b.totalPages,b.filteredPages)||1,l=5*Math.ceil(k/j.pager_maxOptionSize/5),m=k>j.pager_maxOptionSize,n=b.page+1,o=l,p=k-l,q=[1],r=m?l:1;for(d=r;k>=d;)q.push(d),d+=m?l:1;if(q.push(k),m){for(f=[],e=Math.max(Math.floor(j.pager_maxOptionSize/l)-1,5),o=n-e,1>o&&(o=1),p=n+e,p>k&&(p=k),d=o;p>=d;d++)f.push(d);q=a.grep(q,function(b,c){return a.inArray(b,q)===c}),h=q.length,i=f.length,h-i>l/2&&h+i>j.pager_maxOptionSize&&(g=Math.floor(h/2)-Math.floor(i/2),Array.prototype.splice.apply(q,[g,i])),q=q.concat(f)}return q=a.grep(q,function(b,c){return a.inArray(b,q)===c}).sort(function(a,b){return a-b})},fixHeight:function(b,c){var d,e,f=c.pager,g=c.widgetOptions,h=c.$tbodies.eq(0);h.find("tr.pagerSavedHeightSpacer").remove(),g.pager_fixedHeight&&!f.isDisabled&&(e=a.data(b,"pagerSavedHeight"),e&&(d=e-h.height(),d>5&&a.data(b,"pagerLastSize")===f.size&&h.children("tr:visible").length')))},changeHeight:function(c,d){var e,f=d.$tbodies.eq(0);f.find("tr.pagerSavedHeightSpacer").remove(),f.children("tr:visible").length||f.append(' '),e=f.children("tr").eq(0).height()*d.pager.size,a.data(c,"pagerSavedHeight",e),b.fixHeight(c,d),a.data(c,"pagerLastSize",d.pager.size)},hideRows:function(a,b){if(!b.widgetOptions.pager_ajaxUrl){var d,e=0,f=b.pager,g=b.widgetOptions,h=b.$tbodies.eq(0).children("tr"),i=h.length,j=f.page*f.size,k=j+f.size,l=g&&g.filter_filteredRow||"filtered",m=0,n=0;for(f.cacheIndex=[],d=0;i>d;d++)h[d].className.match(l)||(n===j&&h[d].className.match(b.cssChildRow)?h[d].style.display="none":(h[d].style.display=n>=j&&k>n?"":"none",m!==n&&n>=j&&k>n&&(f.cacheIndex.push(d),m=n),n+=h[d].className.match(b.cssChildRow+"|"+b.selectorRemove.slice(1))&&!g.pager_countChildRows?0:1,n===k&&"none"!==h[d].style.display&&h[d].className.match(c.css.cssHasChild)&&(e=d)));if(e>0&&h[e].className.match(c.css.cssHasChild))for(;++e> Ajax Error",g,h),c.showError(e,h.message+" ("+g.status+")"),f.$tbodies.eq(0).children("tr").detach(),i.totalRows=0;else{if(a.isArray(w)?(m=isNaN(w[0])&&!isNaN(w[1]),t=w[m?1:0],i.totalRows=isNaN(t)?i.totalRows||0:t,f.totalRows=f.filteredRows=i.filteredRows=i.totalRows,r=0===i.totalRows?[""]:w[m?0:1]||[],q=w[2]):(i.ajaxData=w,f.totalRows=i.totalRows=w.total,f.filteredRows=i.filteredRows="undefined"!=typeof w.filteredRows?w.filteredRows:w.total,q=w.headers,r=w.rows),s=r&&r.length,r instanceof jQuery)j.pager_processAjaxOnInit&&(f.$tbodies.eq(0).children("tr").detach(),f.$tbodies.eq(0).append(r));else if(s){for(k=0;s>k;k++){for(v+="",l=0;l"+r[k][l]+"";v+=""}j.pager_processAjaxOnInit&&f.$tbodies.eq(0).html(v)}j.pager_processAjaxOnInit=!0,q&&q.length===x&&(n=u.hasClass("hasStickyHeaders"),p=n?j.$sticky.children("thead:first").children("tr").children():"",o=u.find("tfoot tr:first").children(),f.$headers.filter("th").each(function(b){var d,e=a(this);e.find("."+c.css.icon).length?(d=e.find("."+c.css.icon).clone(!0),e.find(".tablesorter-header-inner").html(q[b]).append(d),n&&p.length&&(d=p.eq(b).find("."+c.css.icon).clone(!0),p.eq(b).find(".tablesorter-header-inner").html(q[b]).append(d))):(e.find(".tablesorter-header-inner").html(q[b]),n&&p.length&&p.eq(b).find(".tablesorter-header-inner").html(q[b])),o.eq(b).html(q[b])}))}f.showProcessing&&c.isProcessing(e),i.totalPages=Math.ceil(i.totalRows/(i.size||i.setSize||10)),i.last.totalRows=i.totalRows,i.last.currentFilters=i.currentFilters,i.last.sortList=(f.sortList||[]).join(","),i.initializing=!1,b.updatePageDisplay(e,f,!1),u.trigger("updateCache",[function(){i.initialized&&setTimeout(function(){f.debug&&c.log("Pager: Triggering pagerChange"),u.trigger("applyWidgets").trigger("pagerChange",i),b.updatePageDisplay(e,f)},0)}])}i.initialized||f.$table.trigger("applyWidgets")},getAjax:function(d,e){var f,g=b.getAjaxUrl(d,e),h=a(document),i=e.pager;""!==g&&(e.showProcessing&&c.isProcessing(d,!0),h.on("ajaxError.pager",function(a,c,f,g){b.renderAjax(null,d,e,c,g),h.off("ajaxError.pager")}),f=++i.ajaxCounter,i.last.ajaxUrl=g,i.ajaxObject.url=g,i.ajaxObject.success=function(a,c,g){fe;e++)n.push(l+"["+j[e][0]+"]="+j[e][1]);i=i.replace(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/g,n.length?n.join("&"):l),n=[]}if(m){for(m=m[1],f=k.length,e=0;f>e;e++)k[e]&&n.push(m+"["+e+"]="+encodeURIComponent(k[e]));i=i.replace(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/g,n.length?n.join("&"):m),g.currentFilters=k}return a.isFunction(h.pager_customAjaxUrl)&&(i=h.pager_customAjaxUrl(b,i)),d.debug&&c.log("Pager: Ajax url = "+i),i},renderTable:function(a,d){var e,f,g,h,i=a.config,j=i.pager,k=i.widgetOptions,l=i.$table.hasClass("hasFilters"),m=d&&d.length||0,n=j.page*j.size,o=j.size;if(1>m)return void(i.debug&&c.log("Pager: >> No rows for pager to render"));if(j.page>=j.totalPages)return b.moveToLastPage(a,j);if(j.cacheIndex=[],j.isDisabled=!1,j.initialized&&(i.debug&&c.log("Pager: Triggering pagerChange"),i.$table.trigger("pagerChange",i)),k.pager_removeRows){for(c.clearTableBody(a),e=c.processTbody(a,i.$tbodies.eq(0),!0),f=l?0:n,g=l?0:n,h=0;o>h&&fn&&o>=h&&(h++,j.cacheIndex.push(f),e.append(d[f]))),f++;c.processTbody(a,e,!1)}else b.hideRows(a,i);b.updatePageDisplay(a,i),k.pager_startPage=j.page,k.pager_size=j.size,a.isUpdating&&(i.debug&&c.log("Pager: Triggering updateComplete"),i.$table.trigger("updateComplete",[a,!0]))},showAllRows:function(d,e){var f=e.pager,g=e.widgetOptions;f.ajax?b.pagerArrows(e,!0):(f.isDisabled=!0,a.data(d,"pagerLastPage",f.page),a.data(d,"pagerLastSize",f.size),f.page=0,f.size=f.totalRows,f.totalPages=1,e.$table.addClass("pagerDisabled").removeAttr("aria-describedby").find("tr.pagerSavedHeightSpacer").remove(),b.renderTable(d,e.rowsCopy),e.$table.trigger("applyWidgets"),e.debug&&c.log("Pager: Disabled")),f.$size.add(f.$goto).each(function(){a(this).attr("aria-disabled","true").addClass(g.pager_css.disabled)[0].disabled=!0})},updateCache:function(c){var d=c.config,e=d.pager;d.$table.trigger("updateCache",[function(){if(!a.isEmptyObject(c.config.cache)){var f,g=[],h=c.config.cache[0].normalized;for(e.totalRows=h.length,f=0;fg-1&&0!==g&&(e.page=g-1),j.currentFilters=""===(j.currentFilters||[]).join("")?[]:j.currentFilters,e.currentFilters=""===(e.currentFilters||[]).join("")?[]:e.currentFilters,(j.page!==e.page||j.size!==e.size||j.totalRows!==e.totalRows||(j.currentFilters||[]).join(",")!==(e.currentFilters||[]).join(",")||(j.ajaxUrl||"")!==(e.ajaxObject.url||"")||(j.optAjaxUrl||"")!==(i.pager_ajaxUrl||"")||j.sortList!==(h.sortList||[]).join(","))&&(h.debug&&c.log("Pager: Changing to page "+e.page),e.last={page:e.page,size:e.size,sortList:(h.sortList||[]).join(","),totalRows:e.totalRows,currentFilters:e.currentFilters||[],ajaxUrl:e.ajaxObject.url||"",optAjaxUrl:i.pager_ajaxUrl},e.ajax?b.getAjax(d,h):e.ajax||b.renderTable(d,h.rowsCopy),a.data(d,"pagerLastPage",e.page),e.initialized&&f!==!1&&(h.debug&&c.log("Pager: Triggering pageMoved"),h.$table.trigger("pageMoved",h).trigger("applyWidgets"),!e.ajax&&d.isUpdating&&(h.debug&&c.log("Pager: Triggering updateComplete"),h.$table.trigger("updateComplete",[d,!0])))))}},setPageSize:function(c,d,e){var f=e.pager;f.size=d||f.size||f.setSize||10,f.$size.val(f.size),a.data(c,"pagerLastPage",f.page),a.data(c,"pagerLastSize",f.size),f.totalPages=Math.ceil(f.totalRows/f.size),f.filteredPages=Math.ceil(f.filteredRows/f.size),b.moveToPage(c,f,!0)},moveToFirstPage:function(a,c){c.page=0,b.moveToPage(a,c,!0)},moveToLastPage:function(a,c){c.page=Math.min(c.totalPages,c.filteredPages)-1,b.moveToPage(a,c,!0)},moveToNextPage:function(a,c){c.page++,c.page>=Math.min(c.totalPages,c.filteredPages)-1&&(c.page=Math.min(c.totalPages,c.filteredPages)-1),b.moveToPage(a,c,!0)},moveToPrevPage:function(a,c){c.page--,c.page<=0&&(c.page=0),b.moveToPage(a,c,!0)},destroyPager:function(d,e,f){var g=e.pager;g.initialized=!1,e.$table.off(a.trim(g.events.split(" ").join(".pager "))),f||(b.showAllRows(d,e),g.$container.hide(),e.appender=null,delete d.config.rowsCopy,c.storage&&c.storage(d,e.widgetOptions.pager_storageKey,""))},enablePager:function(d,e,f){var g,h=e.pager;h.isDisabled=!1,h.page=a.data(d,"pagerLastPage")||h.page||0,h.size=a.data(d,"pagerLastSize")||parseInt(h.$size.find("option[selected]").val(),10)||h.size||h.setSize||10,h.$size.val(h.size),h.totalPages=Math.ceil(Math.min(h.totalRows,h.filteredRows)/h.size),e.$table.removeClass("pagerDisabled"),d.id&&(g=d.id+"_pager_info",h.$container.find(e.widgetOptions.pager_selectors.pageDisplay).attr("id",g),e.$table.attr("aria-describedby",g)),b.changeHeight(d,e),f&&(e.$table.trigger("updateRows"),b.setPageSize(d,h.size,e),b.hideRowsSetup(d,e),e.debug&&c.log("Pager: Enabled"))},appender:function(c,d){var e=c.config,f=e.widgetOptions,g=e.pager;g.ajax?b.moveToPage(c,g,!0):(e.rowsCopy=d,g.totalRows=f.pager_countChildRows?e.$tbodies.eq(0).children("tr").length:d.length,g.size=a.data(c,"pagerLastSize")||g.size||f.pager_size||g.setSize||10,g.totalPages=Math.ceil(g.totalRows/g.size),b.moveToPage(c,g),b.updatePageDisplay(c,e,!1))}},c.showError=function(b,c){a(b).each(function(){var b,d=this.config,e=d.widgetOptions,f=d.pager&&d.pager.cssErrorRow||e.pager_css&&e.pager_css.errorRow||"tablesorter-errorRow";d&&("undefined"==typeof c?d.$table.find("thead").find(d.selectorRemove).remove():b=a(/tr\>/.test(c)?c:''+c+"").click(function(){a(this).remove()}).appendTo(d.$table.find("thead:first")).addClass(f+" "+d.selectorRemove.slice(1)).attr({role:"alert","aria-live":"assertive"}))})}}(jQuery); \ No newline at end of file +!function(a){"use strict";var b,c=a.tablesorter;c.addWidget({id:"pager",priority:55,options:{pager_output:"{startRow} to {endRow} of {totalRows} rows",pager_updateArrows:!0,pager_startPage:0,pager_pageReset:0,pager_size:10,pager_maxOptionSize:20,pager_savePages:!0,pager_storageKey:"tablesorter-pager",pager_fixedHeight:!1,pager_countChildRows:!1,pager_removeRows:!1,pager_ajaxUrl:null,pager_customAjaxUrl:function(a,b){return b},pager_ajaxObject:{dataType:"json"},pager_processAjaxOnInit:!0,pager_ajaxProcessing:function(){return[0,[],null]},pager_css:{container:"tablesorter-pager",errorRow:"tablesorter-errorRow",disabled:"disabled"},pager_selectors:{container:".pager",first:".first",prev:".prev",next:".next",last:".last",gotoPage:".gotoPage",pageDisplay:".pagedisplay",pageSize:".pagesize"}},init:function(a){b.init(a)},format:function(a,c){return c.pager&&c.pager.initialized?void b.moveToPage(a,c.pager,!1):b.initComplete(a,c)},remove:function(a,c,d,e){b.destroyPager(a,c,e)}}),b=c.pager={init:function(d){if(!d.hasInitialized||!d.config.pager.initialized){var e,f=d.config,g=f.widgetOptions,h=g.pager_selectors,i=f.pager=a.extend({totalPages:0,filteredRows:0,filteredPages:0,currentFilters:[],page:g.pager_startPage,startRow:0,endRow:0,ajaxCounter:0,$size:null,last:{},setSize:g.pager_size,setPage:g.pager_startPage,events:"filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize pageSet pageAndSize pagerUpdate "},f.pager);i.isInitializing||(i.isInitializing=!0,f.debug&&c.log("Pager: Initializing"),i.size=a.data(d,"pagerLastSize")||g.pager_size,i.$container=a(h.container).addClass(g.pager_css.container).show(),i.$goto=i.$container.find(h.gotoPage),i.$size=i.$container.find(h.pageSize),i.totalRows=f.$tbodies.eq(0).children("tr").not(g.pager_countChildRows?"":"."+f.cssChildRow).length,i.oldAjaxSuccess=i.oldAjaxSuccess||g.pager_ajaxObject.success,f.appender=b.appender,i.initializing=!0,g.pager_savePages&&c.storage&&(e=c.storage(d,g.pager_storageKey)||{},i.page=(isNaN(e.page)?i.page:e.page)||i.setPage||0,i.size=(isNaN(e.size)?i.size:e.size)||i.setSize||10,a.data(d,"pagerLastSize",i.size)),i.regexRows=new RegExp("("+(g.filter_filteredRow||"filtered")+"|"+f.selectorRemove.slice(1)+"|"+f.cssChildRow+")"),i.initialized=!1,f.$table.trigger("pagerBeforeInitialized",f),b.enablePager(d,f,!1),i.ajaxObject=g.pager_ajaxObject,i.ajaxObject.url=g.pager_ajaxUrl,"string"==typeof g.pager_ajaxUrl?(i.ajax=!0,g.filter_serversideFiltering=!0,f.serverSideSorting=!0,b.moveToPage(d,i)):(i.ajax=!1,f.$table.trigger("appendCache",[{},!0])))}},initComplete:function(a,d){var e=d.pager;b.bindEvents(a,d),b.setPageSize(a,0,d),e.ajax||b.hideRowsSetup(a,d),e.initialized=!0,e.initializing=!1,e.isInitializing=!1,d.debug&&c.log("Pager: Triggering pagerInitialized"),d.$table.trigger("pagerInitialized",d),d.widgetOptions.filter_initialized&&c.hasWidget(a,"filter")||b.updatePageDisplay(a,d,!e.ajax)},bindEvents:function(d,e){var f,g,h=e.pager,i=e.widgetOptions,j=i.pager_selectors;e.$table.off(a.trim(h.events.split(" ").join(".pager "))).on("filterInit.pager filterStart.pager",function(b,c){h.currentFilters=a.isArray(c)?c:e.$table.data("lastSearch"),"filterStart"===b.type&&i.pager_pageReset!==!1&&(e.lastCombinedFilter||"")!==(h.currentFilters||[]).join("")&&(h.page=i.pager_pageReset)}).on("filterEnd.pager sortEnd.pager",function(){h.currentFilters=e.$table.data("lastSearch"),(h.initialized||h.initializing)&&(e.delayInit&&e.rowsCopy&&0===e.rowsCopy.length&&b.updateCache(d),b.updatePageDisplay(d,e,!1),e.$table.trigger("applyWidgets"))}).on("disable.pager",function(a){a.stopPropagation(),b.showAllRows(d,e)}).on("enable.pager",function(a){a.stopPropagation(),b.enablePager(d,e,!0)}).on("destroy.pager",function(a,c){a.stopPropagation(),b.destroyPager(d,e,c)}).on("updateComplete.pager",function(a,c,d){if(a.stopPropagation(),c&&!d&&!h.ajax){var f=e.$tbodies.eq(0).children("tr").not(e.selectorRemove);h.totalRows=f.length-(i.pager_countChildRows?0:f.filter("."+e.cssChildRow).length),h.totalPages=Math.ceil(h.totalRows/h.size),f.length&&e.rowsCopy&&0===e.rowsCopy.length&&b.updateCache(c),h.page>=h.totalPages&&b.moveToLastPage(c,h),b.hideRows(c,e),b.changeHeight(c,e),b.updatePageDisplay(c,e,!1),e.$table.trigger("applyWidgets"),b.updatePageDisplay(c,e)}}).on("pageSize.pager refreshComplete.pager",function(a,c){a.stopPropagation(),b.setPageSize(d,parseInt(c,10)||h.setSize||10,e),b.hideRows(d,e),b.updatePageDisplay(d,e,!1)}).on("pageSet.pager pagerUpdate.pager",function(a,c){a.stopPropagation(),h.page=(parseInt(c,10)||1)-1,"pagerUpdate"===a.type&&(h.last.page=!0),b.moveToPage(d,h,!0),b.updatePageDisplay(d,e,!1)}).on("pageAndSize.pager",function(a,c,f){a.stopPropagation(),h.page=(parseInt(c,10)||1)-1,b.setPageSize(d,parseInt(f,10)||h.setSize||10,e),b.moveToPage(d,h,!0),b.hideRows(d,e),b.updatePageDisplay(d,e,!1)}),f=[j.first,j.prev,j.next,j.last],g=["moveToFirstPage","moveToPrevPage","moveToNextPage","moveToLastPage"],e.debug&&!h.$container.length&&c.log("Pager: >> Container not found"),h.$container.find(f.join(",")).attr("tabindex",0).off("click.pager").on("click.pager",function(c){c.stopPropagation();var e,j=a(this),k=f.length;if(!j.hasClass(i.pager_css.disabled))for(e=0;k>e;e++)if(j.is(f[e])){b[g[e]](d,h);break}}),h.$goto.length?h.$goto.off("change.pager").on("change.pager",function(){h.page=a(this).val()-1,b.moveToPage(d,h,!0),b.updatePageDisplay(d,e,!1)}):e.debug&&c.log("Pager: >> Goto selector not found"),h.$size.length?(h.$size.find("option").removeAttr("selected"),h.$size.off("change.pager").on("change.pager",function(){return h.$size.val(a(this).val()),a(this).hasClass(i.pager_css.disabled)||(b.setPageSize(d,parseInt(a(this).val(),10),e),b.changeHeight(d,e)),!1})):e.debug&&c.log("Pager: >> Size selector not found")},pagerArrows:function(a,b){var c=a.pager,d=!!b,e=d||0===c.page,f=Math.min(c.totalPages,c.filteredPages),g=d||c.page===f-1||0===f,h=a.widgetOptions,i=h.pager_selectors;h.pager_updateArrows&&(c.$container.find(i.first+","+i.prev).toggleClass(h.pager_css.disabled,e).attr("aria-disabled",e),c.$container.find(i.next+","+i.last).toggleClass(h.pager_css.disabled,g).attr("aria-disabled",g))},calcFilters:function(b,c){var d,e,f,g=c.widgetOptions,h=c.pager,i=c.$table.hasClass("hasFilters");if(i&&!g.pager_ajaxUrl)if(a.isEmptyObject(c.cache))h.filteredRows=h.totalRows=c.$tbodies.eq(0).children("tr").not(g.pager_countChildRows?"":"."+c.cssChildRow).length;else for(h.filteredRows=0,d=c.cache[0].normalized,f=d.length,e=0;f>e;e++)h.filteredRows+=h.regexRows.test(d[e][c.columns].$row[0].className)?0:1;else i||(h.filteredRows=h.totalRows)},updatePageDisplay:function(d,e,f){if(!e.pager.initializing){var g,h,i,j,k,l,m=e.widgetOptions,n=e.pager,o=n.size||n.setSize||10;if(m.pager_countChildRows&&h.push(e.cssChildRow),n.$size.add(n.$goto).removeClass(m.pager_css.disabled).removeAttr("disabled").attr("aria-disabled","false"),n.totalPages=Math.ceil(n.totalRows/o),e.totalRows=n.totalRows,b.calcFilters(d,e),e.filteredRows=n.filteredRows,n.filteredPages=Math.ceil(n.filteredRows/o)||0,Math.min(n.totalPages,n.filteredPages)>=0){if(h=n.size*n.page>n.filteredRows&&f,n.page=h?m.pager_pageReset||0:n.page,n.startRow=h?n.size*n.page+1:0===n.filteredRows?0:n.size*n.page+1,n.endRow=Math.min(n.filteredRows,n.totalRows,n.size*(n.page+1)),i=n.$container.find(m.pager_selectors.pageDisplay),g=(n.ajaxData&&n.ajaxData.output?n.ajaxData.output||m.pager_output:m.pager_output).replace(/\{page([\-+]\d+)?\}/gi,function(a,b){return n.totalPages?n.page+(b?parseInt(b,10):1):0}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(a){var b,c,d=a.replace(/[{}\s]/g,""),e=d.split(":"),f=n.ajaxData,g=/(rows?|pages?)$/i.test(d)?0:"";return/(startRow|page)/.test(e[0])&&"input"===e[1]?(b=(""+("page"===e[0]?n.totalPages:n.totalRows)).length,c="page"===e[0]?n.page+1:n.startRow,''):e.length>1&&f&&f[e[0]]?f[e[0]][e[1]]:n[d]||(f?f[d]:g)||g}),n.$goto.length){for(h="",j=b.buildPageSelect(n,e),l=j.length,k=0;l>k;k++)h+='";n.$goto.html(h).val(n.page+1)}i.length&&(i["INPUT"===i[0].tagName?"val":"html"](g),i.find(".ts-startRow, .ts-page").off("change.pager").on("change.pager",function(){var b=a(this).val(),c=a(this).hasClass("ts-startRow")?Math.floor(b/n.size)+1:b;e.$table.trigger("pageSet.pager",[c])}))}b.pagerArrows(e),b.fixHeight(d,e),n.initialized&&f!==!1&&(e.debug&&c.log("Pager: Triggering pagerComplete"),e.$table.trigger("pagerComplete",e),m.pager_savePages&&c.storage&&c.storage(d,m.pager_storageKey,{page:n.page,size:n.size}))}},buildPageSelect:function(b,c){var d,e,f,g,h,i,j=c.widgetOptions,k=Math.min(b.totalPages,b.filteredPages)||1,l=5*Math.ceil(k/j.pager_maxOptionSize/5),m=k>j.pager_maxOptionSize,n=b.page+1,o=l,p=k-l,q=[1],r=m?l:1;for(d=r;k>=d;)q.push(d),d+=m?l:1;if(q.push(k),m){for(f=[],e=Math.max(Math.floor(j.pager_maxOptionSize/l)-1,5),o=n-e,1>o&&(o=1),p=n+e,p>k&&(p=k),d=o;p>=d;d++)f.push(d);q=a.grep(q,function(b,c){return a.inArray(b,q)===c}),h=q.length,i=f.length,h-i>l/2&&h+i>j.pager_maxOptionSize&&(g=Math.floor(h/2)-Math.floor(i/2),Array.prototype.splice.apply(q,[g,i])),q=q.concat(f)}return q=a.grep(q,function(b,c){return a.inArray(b,q)===c}).sort(function(a,b){return a-b})},fixHeight:function(b,c){var d,e,f=c.pager,g=c.widgetOptions,h=c.$tbodies.eq(0);h.find("tr.pagerSavedHeightSpacer").remove(),g.pager_fixedHeight&&!f.isDisabled&&(e=a.data(b,"pagerSavedHeight"),e&&(d=e-h.height(),d>5&&a.data(b,"pagerLastSize")===f.size&&h.children("tr:visible").length')))},changeHeight:function(c,d){var e,f=d.$tbodies.eq(0);f.find("tr.pagerSavedHeightSpacer").remove(),f.children("tr:visible").length||f.append(' '),e=f.children("tr").eq(0).height()*d.pager.size,a.data(c,"pagerSavedHeight",e),b.fixHeight(c,d),a.data(c,"pagerLastSize",d.pager.size)},hideRows:function(a,b){if(!b.widgetOptions.pager_ajaxUrl){var d,e=0,f=b.pager,g=b.widgetOptions,h=b.$tbodies.eq(0).children("tr"),i=h.length,j=f.page*f.size,k=j+f.size,l=g&&g.filter_filteredRow||"filtered",m=0,n=0;for(f.cacheIndex=[],d=0;i>d;d++)h[d].className.match(l)||(n===j&&h[d].className.match(b.cssChildRow)?h[d].style.display="none":(h[d].style.display=n>=j&&k>n?"":"none",m!==n&&n>=j&&k>n&&(f.cacheIndex.push(d),m=n),n+=h[d].className.match(b.cssChildRow+"|"+b.selectorRemove.slice(1))&&!g.pager_countChildRows?0:1,n===k&&"none"!==h[d].style.display&&h[d].className.match(c.css.cssHasChild)&&(e=d)));if(e>0&&h[e].className.match(c.css.cssHasChild))for(;++e> Ajax Error",g,h),c.showError(e,h.message+" ("+g.status+")"),f.$tbodies.eq(0).children("tr").detach(),i.totalRows=0;else{if(a.isArray(w)?(m=isNaN(w[0])&&!isNaN(w[1]),t=w[m?1:0],i.totalRows=isNaN(t)?i.totalRows||0:t,f.totalRows=f.filteredRows=i.filteredRows=i.totalRows,r=0===i.totalRows?[""]:w[m?0:1]||[],q=w[2]):(i.ajaxData=w,f.totalRows=i.totalRows=w.total,f.filteredRows=i.filteredRows="undefined"!=typeof w.filteredRows?w.filteredRows:w.total,q=w.headers,r=w.rows),s=r&&r.length,r instanceof jQuery)j.pager_processAjaxOnInit&&(f.$tbodies.eq(0).children("tr").detach(),f.$tbodies.eq(0).append(r));else if(s){for(k=0;s>k;k++){for(v+="",l=0;l"+r[k][l]+"";v+=""}j.pager_processAjaxOnInit&&f.$tbodies.eq(0).html(v)}j.pager_processAjaxOnInit=!0,q&&q.length===x&&(n=u.hasClass("hasStickyHeaders"),p=n?j.$sticky.children("thead:first").children("tr").children():"",o=u.find("tfoot tr:first").children(),f.$headers.filter("th").each(function(b){var d,e=a(this);e.find("."+c.css.icon).length?(d=e.find("."+c.css.icon).clone(!0),e.find(".tablesorter-header-inner").html(q[b]).append(d),n&&p.length&&(d=p.eq(b).find("."+c.css.icon).clone(!0),p.eq(b).find(".tablesorter-header-inner").html(q[b]).append(d))):(e.find(".tablesorter-header-inner").html(q[b]),n&&p.length&&p.eq(b).find(".tablesorter-header-inner").html(q[b])),o.eq(b).html(q[b])}))}f.showProcessing&&c.isProcessing(e),i.totalPages=Math.ceil(i.totalRows/(i.size||i.setSize||10)),i.last.totalRows=i.totalRows,i.last.currentFilters=i.currentFilters,i.last.sortList=(f.sortList||[]).join(","),i.initializing=!1,b.updatePageDisplay(e,f,!1),u.trigger("updateCache",[function(){i.initialized&&setTimeout(function(){f.debug&&c.log("Pager: Triggering pagerChange"),u.trigger("applyWidgets").trigger("pagerChange",i),b.updatePageDisplay(e,f)},0)}])}i.initialized||f.$table.trigger("applyWidgets")},getAjax:function(d,e){var f,g=b.getAjaxUrl(d,e),h=a(document),i=e.pager;""!==g&&(e.showProcessing&&c.isProcessing(d,!0),h.on("ajaxError.pager",function(a,c,f,g){b.renderAjax(null,d,e,c,g),h.off("ajaxError.pager")}),f=++i.ajaxCounter,i.last.ajaxUrl=g,i.ajaxObject.url=g,i.ajaxObject.success=function(a,c,g){fe;e++)n.push(l+"["+j[e][0]+"]="+j[e][1]);i=i.replace(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/g,n.length?n.join("&"):l),n=[]}if(m){for(m=m[1],f=k.length,e=0;f>e;e++)k[e]&&n.push(m+"["+e+"]="+encodeURIComponent(k[e]));i=i.replace(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/g,n.length?n.join("&"):m),g.currentFilters=k}return a.isFunction(h.pager_customAjaxUrl)&&(i=h.pager_customAjaxUrl(b,i)),d.debug&&c.log("Pager: Ajax url = "+i),i},renderTable:function(a,d){var e,f,g,h,i=a.config,j=i.pager,k=i.widgetOptions,l=i.$table.hasClass("hasFilters"),m=d&&d.length||0,n=j.page*j.size,o=j.size;if(1>m)return void(i.debug&&c.log("Pager: >> No rows for pager to render"));if(j.page>=j.totalPages)return b.moveToLastPage(a,j);if(j.cacheIndex=[],j.isDisabled=!1,j.initialized&&(i.debug&&c.log("Pager: Triggering pagerChange"),i.$table.trigger("pagerChange",i)),k.pager_removeRows){for(c.clearTableBody(a),e=c.processTbody(a,i.$tbodies.eq(0),!0),f=l?0:n,g=l?0:n,h=0;o>h&&fn&&o>=h&&(h++,j.cacheIndex.push(f),e.append(d[f]))),f++;c.processTbody(a,e,!1)}else b.hideRows(a,i);b.updatePageDisplay(a,i),k.pager_startPage=j.page,k.pager_size=j.size,a.isUpdating&&(i.debug&&c.log("Pager: Triggering updateComplete"),i.$table.trigger("updateComplete",[a,!0]))},showAllRows:function(d,e){var f=e.pager,g=e.widgetOptions;f.ajax?b.pagerArrows(e,!0):(f.isDisabled=!0,a.data(d,"pagerLastPage",f.page),a.data(d,"pagerLastSize",f.size),f.page=0,f.size=f.totalRows,f.totalPages=1,e.$table.addClass("pagerDisabled").removeAttr("aria-describedby").find("tr.pagerSavedHeightSpacer").remove(),b.renderTable(d,e.rowsCopy),e.$table.trigger("applyWidgets"),e.debug&&c.log("Pager: Disabled")),f.$size.add(f.$goto).each(function(){a(this).attr("aria-disabled","true").addClass(g.pager_css.disabled)[0].disabled=!0})},updateCache:function(c){var d=c.config,e=d.pager;d.$table.trigger("updateCache",[function(){if(!a.isEmptyObject(c.config.cache)){var f,g=[],h=c.config.cache[0].normalized;for(e.totalRows=h.length,f=0;fg-1&&0!==g&&(e.page=g-1),j.currentFilters=""===(j.currentFilters||[]).join("")?[]:j.currentFilters,e.currentFilters=""===(e.currentFilters||[]).join("")?[]:e.currentFilters,(j.page!==e.page||j.size!==e.size||j.totalRows!==e.totalRows||(j.currentFilters||[]).join(",")!==(e.currentFilters||[]).join(",")||(j.ajaxUrl||"")!==(e.ajaxObject.url||"")||(j.optAjaxUrl||"")!==(i.pager_ajaxUrl||"")||j.sortList!==(h.sortList||[]).join(","))&&(h.debug&&c.log("Pager: Changing to page "+e.page),e.last={page:e.page,size:e.size,sortList:(h.sortList||[]).join(","),totalRows:e.totalRows,currentFilters:e.currentFilters||[],ajaxUrl:e.ajaxObject.url||"",optAjaxUrl:i.pager_ajaxUrl},e.ajax?b.getAjax(d,h):e.ajax||b.renderTable(d,h.rowsCopy),a.data(d,"pagerLastPage",e.page),e.initialized&&f!==!1&&(h.debug&&c.log("Pager: Triggering pageMoved"),h.$table.trigger("pageMoved",h).trigger("applyWidgets"),!e.ajax&&d.isUpdating&&(h.debug&&c.log("Pager: Triggering updateComplete"),h.$table.trigger("updateComplete",[d,!0])))))}},setPageSize:function(c,d,e){var f=e.pager;f.size=d||f.size||f.setSize||10,f.$size.val(f.size),a.data(c,"pagerLastPage",f.page),a.data(c,"pagerLastSize",f.size),f.totalPages=Math.ceil(f.totalRows/f.size),f.filteredPages=Math.ceil(f.filteredRows/f.size),b.moveToPage(c,f,!0)},moveToFirstPage:function(a,c){c.page=0,b.moveToPage(a,c,!0)},moveToLastPage:function(a,c){c.page=Math.min(c.totalPages,c.filteredPages)-1,b.moveToPage(a,c,!0)},moveToNextPage:function(a,c){c.page++,c.page>=Math.min(c.totalPages,c.filteredPages)-1&&(c.page=Math.min(c.totalPages,c.filteredPages)-1),b.moveToPage(a,c,!0)},moveToPrevPage:function(a,c){c.page--,c.page<=0&&(c.page=0),b.moveToPage(a,c,!0)},destroyPager:function(d,e,f){var g=e.pager;g.initialized=!1,e.$table.off(a.trim(g.events.split(" ").join(".pager "))),f||(b.showAllRows(d,e),g.$container.hide(),e.appender=null,delete d.config.rowsCopy,c.storage&&c.storage(d,e.widgetOptions.pager_storageKey,""))},enablePager:function(d,e,f){var g,h=e.pager;h.isDisabled=!1,h.page=a.data(d,"pagerLastPage")||h.page||0,h.size=a.data(d,"pagerLastSize")||parseInt(h.$size.find("option[selected]").val(),10)||h.size||h.setSize||10,h.$size.val(h.size),h.totalPages=Math.ceil(Math.min(h.totalRows,h.filteredRows)/h.size),e.$table.removeClass("pagerDisabled"),d.id&&(g=d.id+"_pager_info",h.$container.find(e.widgetOptions.pager_selectors.pageDisplay).attr("id",g),e.$table.attr("aria-describedby",g)),b.changeHeight(d,e),f&&(e.$table.trigger("updateRows"),b.setPageSize(d,h.size,e),b.hideRowsSetup(d,e),e.debug&&c.log("Pager: Enabled"))},appender:function(c,d){var e=c.config,f=e.widgetOptions,g=e.pager;g.ajax?b.moveToPage(c,g,!0):(e.rowsCopy=d,g.totalRows=f.pager_countChildRows?e.$tbodies.eq(0).children("tr").length:d.length,g.size=a.data(c,"pagerLastSize")||g.size||f.pager_size||g.setSize||10,g.totalPages=Math.ceil(g.totalRows/g.size),b.moveToPage(c,g),b.updatePageDisplay(c,e,!1))}},c.showError=function(b,c){a(b).each(function(){var b,d=this.config,e=d.widgetOptions,f=d.pager&&d.pager.cssErrorRow||e.pager_css&&e.pager_css.errorRow||"tablesorter-errorRow";d&&("undefined"==typeof c?d.$table.find("thead").find(d.selectorRemove).remove():b=a(/tr\>/.test(c)?c:''+c+"").click(function(){a(this).remove()}).appendTo(d.$table.find("thead:first")).addClass(f+" "+d.selectorRemove.slice(1)).attr({role:"alert","aria-live":"assertive"}))})}}(jQuery); \ No newline at end of file diff --git a/js/widgets/widget-pager.js b/js/widgets/widget-pager.js index aeb7f463..8d1db11c 100644 --- a/js/widgets/widget-pager.js +++ b/js/widgets/widget-pager.js @@ -268,7 +268,8 @@ tsp = ts.pager = { .on('updateComplete.pager', function(e, table, triggered){ e.stopPropagation(); // table can be unintentionally undefined in tablesorter v2.17.7 and earlier - if (!table || triggered) { return; } + // don't recalculate total rows/pages if using ajax + if (!table || triggered || p.ajax) { return; } var $rows = c.$tbodies.eq(0).children('tr').not(c.selectorRemove); p.totalRows = $rows.length - ( wo.pager_countChildRows ? 0 : $rows.filter('.' + c.cssChildRow).length ); p.totalPages = Math.ceil( p.totalRows / p.size );