diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index 01cc4a93..16a614d4 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -1198,7 +1198,7 @@ valid = true, message = '', removeRow = function(){ - c.$table.find( 'thead' ).find( '.' + errorRow ).remove(); + c.$table.find( 'thead' ).find( c.selectorRemove ).remove(); }; if ( !$table.length ) { diff --git a/dist/js/extras/jquery.tablesorter.pager.min.js b/dist/js/extras/jquery.tablesorter.pager.min.js index d7ff4554..82d17087 100644 --- a/dist/js/extras/jquery.tablesorter.pager.min.js +++ b/dist/js/extras/jquery.tablesorter.pager.min.js @@ -2,4 +2,4 @@ * tablesorter (FORK) pager plugin * updated 4/18/2017 (v2.28.8) */ -!function(e){"use strict";var t=e.tablesorter;e.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(e,t){return t},ajaxError:null,ajaxObject:{dataType:"json"},processAjaxOnInit:!0,ajaxProcessing:function(e){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 a="filterInit filterStart filterEnd sortEnd disablePager enablePager destroyPager updateComplete pageSize pageSet pageAndSize pagerUpdate refreshComplete ",i=this,s=function(e,t,a){var i,s="addClass",r="removeClass",o=t.cssDisabled,n=!!a,l=n||0===t.page,g=z(e,t),c=n||t.page===g-1||0===g;t.updateArrows&&((i=t.$container.find(t.cssFirst+","+t.cssPrev))[l?s:r](o),i.each(function(){this.ariaDisabled=l}),(i=t.$container.find(t.cssNext+","+t.cssLast))[c?s:r](o),i.each(function(){this.ariaDisabled=c}))},r=function(e,a){var i,s,r,o=e.config,n=o.$table.hasClass("hasFilters");if(n&&!a.ajax)if(t.isEmptyObject(o.cache))a.filteredRows=a.totalRows=o.$tbodies.eq(0).children("tr").not(a.countChildRows?"":"."+o.cssChildRow).length;else for(a.filteredRows=0,r=(i=o.cache[0].normalized).length,s=0;s=0){if(c=P*i.page>i.filteredRows&&o,i.page=c?i.pageReset||0:i.page,i.startRow=c?P*i.page+1:0===i.filteredRows?0:P*i.page+1,i.endRow=Math.min(i.filteredRows,i.totalRows,P*(i.page+1)),d=i.$container.find(i.cssPageDisplay),"function"==typeof i.output?g=i.output(a,i):(w=d.attr("data-pager-output"+(i.filteredRows'):r.length>1&&o&&o[r[0]]?o[r[0]][r[1]]:i[s]||(o?o[s]:n)||n})),(p=i.$container.find(i.cssGoto)).length){for(c="",u=(h=n(a,i)).length,f=0;f'+h[f]+"";p.html(c).val(i.page+1)}d.length&&(d["INPUT"===d[0].nodeName?"val":"html"](g),d.find(".ts-startRow, .ts-page").unbind("change"+R).bind("change"+R,function(){var t=e(this).val(),a=e(this).hasClass("ts-startRow")?Math.floor(t/P)+1:t;b.$table.triggerHandler("pageSet"+R,[a])}))}s(a,i),l(a,i),i.initialized&&!1!==o&&(b.debug&&console.log("Pager: Triggering pagerComplete"),b.$table.triggerHandler("pagerComplete",i),i.savePages&&t.storage&&t.storage(a,i.storageKey,{page:i.page,size:P===i.totalRows?"all":P}))}},n=function(t,a){var i,s,r,o,n,l,g=z(t,a)||1,c=5*Math.ceil(g/a.maxOptionSize/5),d=g>a.maxOptionSize,p=a.page+1,f=c,u=g-c,h=[1];for(i=d?c:1;i<=g;)h[h.length]=i,i+=d?c:1;if(h[h.length]=g,d){for(r=[],(f=p-(s=Math.max(Math.floor(a.maxOptionSize/c)-1,5)))<1&&(f=1),(u=p+s)>g&&(u=g),i=f;i<=u;i++)r[r.length]=i;(n=(h=e.grep(h,function(t,a){return e.inArray(t,h)===a})).length)-(l=r.length)>c/2&&n+l>a.maxOptionSize&&(o=Math.floor(n/2)-Math.floor(l/2),Array.prototype.splice.apply(h,[o,l])),h=h.concat(r)}return h=e.grep(h,function(t,a){return e.inArray(t,h)===a}).sort(function(e,t){return e-t})},l=function(t,a){var i,s,r=t.config,o=r.$tbodies.eq(0);o.find("tr.pagerSavedHeightSpacer").remove(),a.fixedHeight&&!a.isDisabled&&(s=e.data(t,"pagerSavedHeight"))&&(i=s-o.height())>5&&e.data(t,"pagerLastSize")===a.size&&o.children("tr:visible").length<("all"===a.size?a.totalRows:a.size)&&o.append('')},g=function(t,a){var i,s=t.config,r=s.$tbodies.eq(0);r.find("tr.pagerSavedHeightSpacer").remove(),r.children("tr:visible").length||r.append(' '),i=r.children("tr").eq(0).height()*("all"===a.size?a.totalRows:a.size),e.data(t,"pagerSavedHeight",i),l(t,a),e.data(t,"pagerLastSize",a.size)},c=function(e,a){if(!a.ajaxUrl){var i,s=0,r=e.config,o=r.$tbodies.eq(0).children("tr"),n=o.length,l="all"===a.size?a.totalRows:a.size,g=a.page*l,c=g+l,d=0,p=0;for(a.cacheIndex=[],i=0;i=g&&p=g&&p0&&o[s].className.match(t.css.cssHasChild))for(;++s> Ajax Error",r,n,l),t.showError(i,r,n,l),y.$tbodies.eq(0).children("tr").detach(),s.totalRows=0;else{if(e.isArray(I)?(P=I[(d=isNaN(I[0])&&!isNaN(I[1]))?1:0],s.totalRows=isNaN(P)?s.totalRows||0:P,y.totalRows=y.filteredRows=s.filteredRows=s.totalRows,z=0===s.totalRows?[]:I[d?0:1]||[],R=I[2]):(s.ajaxData=I,y.totalRows=s.totalRows=I.total,y.filteredRows=s.filteredRows=void 0!==I.filteredRows?I.filteredRows:I.total,R=I.headers,z=I.rows||[]),x=z&&z.length,z instanceof jQuery)s.processAjaxOnInit&&(y.$tbodies.eq(0).empty(),y.$tbodies.eq(0).append(z));else if(x){for(g=0;g",c=0;c"+z[g][c]+"";$+=""}s.processAjaxOnInit&&y.$tbodies.eq(0).html($)}if(s.processAjaxOnInit=!0,R)for(u=(p=C.hasClass("hasStickyHeaders"))?y.widgetOptions.$sticky.children("thead:first").children("tr:not(."+y.cssIgnoreRow+")").children():"",f=C.find("tfoot tr:first").children(),v=(h=y.$headers.filter("th ")).length,c=0;c> No rows for pager to render");else{if(s.page>=s.totalPages&&m(a,s),s.cacheIndex=[],s.isDisabled=!1,s.initialized&&(p.debug&&console.log("Pager: Triggering pagerChange"),d.triggerHandler("pagerChange",s)),s.removeRows){for(t.clearTableBody(a),r=t.processTbody(a,p.$tbodies.eq(0),!0),n=f?0:w,l=f?0:w,g=0;gw&&g<=h&&(g++,s.cacheIndex[s.cacheIndex.length]=n,r.append(i[n])),n++;t.processTbody(a,r,!1)}else c(a,s);o(a,s),a.isUpdating&&(p.debug&&console.log("Pager: Triggering updateComplete"),d.triggerHandler("updateComplete",[a,!0]))}},w=function(a,i){var r,o,n;for(i.ajax?s(a,i,!0):(e.data(a,"pagerLastPage",i.page),e.data(a,"pagerLastSize",i.size),i.page=0,i.size=i.totalPages,i.totalPages=1,e(a).addClass("pagerDisabled").removeAttr("aria-describedby").find("tr.pagerSavedHeightSpacer").remove(),h(a,a.config.rowsCopy,i),i.isDisabled=!0,t.applyWidget(a),a.config.debug&&console.log("Pager: Disabled")),n=(o=i.$container.find(i.cssGoto+","+i.cssPageSize+", .ts-startRow, .ts-page")).length,r=0;ra&&a>=0&&(t.page=a),t.page},j=function(e,t,a){var i=parseInt(t,10)||e.size||e.settings.size||10;return e.initialized&&(/all/i.test(i+" "+t)||i===e.totalRows)?e.$container.find(e.cssPageSize+' option[value="all"]').length?"all":e.totalRows:"get"===a?i:e.size},P=function(t,a,i){i.size=j(i,a,"get"),i.$container.find(i.cssPageSize).val(i.size),e.data(t,"pagerLastPage",x(t,i)),e.data(t,"pagerLastSize",i.size),i.totalPages="all"===i.size?1:Math.ceil(i.totalRows/i.size),i.filteredPages="all"===i.size?1:Math.ceil(i.filteredRows/i.size)},v=function(e,t){t.page=0,R(e,t)},m=function(e,t){t.page=z(e,t)-1,R(e,t)},y=function(e,t){t.page++;var a=z(e,t)-1;t.page>=a&&(t.page=a),R(e,t)},C=function(e,t){--t.page<=0&&(t.page=0),R(e,t)},S=function(a,i){i.initialized=!0,i.initializing=!1,a.config.debug&&console.log("Pager: Triggering pagerInitialized"),e(a).triggerHandler("pagerInitialized",i),t.applyWidget(a),o(a,i)},$=function(t,a){t.config.pager=e.extend(!0,{},e.tablesorterPager.defaults,a.settings),F(t,a.settings)},I=function(e,a){var i=e.config,s=i.namespace+"pager",r=[a.cssFirst,a.cssPrev,a.cssNext,a.cssLast,a.cssGoto,a.cssPageSize].join(",");w(e,a),a.$container.hide().find(r).unbind(s),i.appender=null,i.$table.unbind(s),t.storage&&t.storage(e,a.storageKey,""),delete i.pager,delete i.rowsCopy},A=function(a,i,s){var r,o,n,l=a.config;i.$container.find(i.cssGoto+","+i.cssPageSize+",.ts-startRow, .ts-page").removeClass(i.cssDisabled).removeAttr("disabled").each(function(){this.ariaDisabled=!1}),i.isDisabled=!1,i.page=e.data(a,"pagerLastPage")||i.page||0,o=(n=i.$container.find(i.cssPageSize)).find("option[selected]").val(),i.size=e.data(a,"pagerLastSize")||j(i,o,"get"),i.totalPages="all"===i.size?1:Math.ceil(z(a,i)/i.size),P(a,i.size,i),a.id&&!l.$table.attr("aria-describedby")&&((r=(n=i.$container.find(i.cssPageDisplay)).attr("id"))||(r=a.id+"_pager_info",n.attr("id",r)),l.$table.attr("aria-describedby",r)),g(a,i),s&&(t.update(l),P(a,i.size,i),R(a,i),d(a,i),l.debug&&console.log("Pager: Enabled"))},F=function(s,r){var n,l,p,f,u=s.config,h=u.widgetOptions,z=u.pager=e.extend(!0,{},e.tablesorterPager.defaults,r),x=u.$table,S=u.namespace+"pager",F=z.$container=e(z.container).addClass("tablesorter-pager").show();z.settings=e.extend(!0,{},e.tablesorterPager.defaults,r),u.debug&&console.log("Pager: Initializing"),z.oldAjaxSuccess=z.oldAjaxSuccess||z.ajaxObject.success,u.appender=i.appender,z.initializing=!0,z.savePages&&t.storage&&(n=t.storage(s,z.storageKey)||{},z.page=isNaN(n.page)?z.page:n.page,z.size="all"===n.size?n.size:(isNaN(n.size)?z.size:n.size)||z.setSize||10,P(s,z.size,z)),z.regexRows=new RegExp("("+(h.filter_filteredRow||"filtered")+"|"+u.selectorRemove.slice(1)+"|"+u.cssChildRow+")"),z.regexFiltered=new RegExp(h.filter_filteredRow||"filtered"),x.unbind(a.split(" ").join(S+" ").replace(/\s+/g," ")).bind("filterInit filterStart ".split(" ").join(S+" "),function(a,i){z.currentFilters=e.isArray(i)?i:u.$table.data("lastSearch");var r;if(z.ajax&&"filterInit"===a.type)return R(s,z,!1);r=t.filter.equalFilters?t.filter.equalFilters(u,u.lastSearch,z.currentFilters):(u.lastSearch||[]).join("")!==(z.currentFilters||[]).join(""),"filterStart"!==a.type||!1===z.pageReset||r||(z.page=z.pageReset)}).bind("filterEnd sortEnd ".split(" ").join(S+" "),function(){z.currentFilters=u.$table.data("lastSearch"),(z.initialized||z.initializing)&&(u.delayInit&&u.rowsCopy&&0===u.rowsCopy.length&&b(s),o(s,z,!1),R(s,z,!1),t.applyWidget(s))}).bind("disablePager"+S,function(e){e.stopPropagation(),w(s,z)}).bind("enablePager"+S,function(e){e.stopPropagation(),A(s,z,!0)}).bind("destroyPager"+S,function(e){e.stopPropagation(),I(s,z)}).bind("resetToLoadState"+S,function(e){e.stopPropagation(),$(s,z)}).bind("updateComplete"+S,function(e,t,a){if(e.stopPropagation(),t&&!a&&!z.ajax){var i=u.$tbodies.eq(0).children("tr").not(u.selectorRemove);z.totalRows=i.length-(z.countChildRows?0:i.filter("."+u.cssChildRow).length),z.totalPages="all"===z.size?1:Math.ceil(z.totalRows/z.size),i.length&&u.rowsCopy&&0===u.rowsCopy.length&&b(t),z.page>=z.totalPages&&m(t,z),c(t,z),g(t,z),o(t,z,!0)}}).bind("pageSize refreshComplete ".split(" ").join(S+" "),function(e,t){e.stopPropagation(),P(s,j(z,t,"get"),z),R(s,z),c(s,z),o(s,z,!1)}).bind("pageSet pagerUpdate ".split(" ").join(S+" "),function(e,t){e.stopPropagation(),"pagerUpdate"===e.type&&(t=void 0===t?z.page+1:t,z.last.page=!0),z.page=(parseInt(t,10)||1)-1,R(s,z,!0),o(s,z,!1)}).bind("pageAndSize"+S,function(e,t,a){e.stopPropagation(),z.page=(parseInt(t,10)||1)-1,P(s,j(z,a,"get"),z),R(s,z,!0),c(s,z),o(s,z,!1)}),l=[z.cssFirst,z.cssPrev,z.cssNext,z.cssLast],p=[v,C,y,m],u.debug&&!F.length&&console.warn("Pager: >> Container not found"),F.find(l.join(",")).attr("tabindex",0).unbind("click"+S).bind("click"+S,function(t){t.stopPropagation();var a,i=e(this),r=l.length;if(!i.hasClass(z.cssDisabled))for(a=0;a> Goto selector not found"),(f=F.find(z.cssPageSize)).length?(f.find("option").removeAttr("selected"),f.unbind("change"+S).bind("change"+S,function(){if(!e(this).hasClass(z.cssDisabled)){var t=e(this).val();P(s,t,z),R(s,z),g(s,z)}return!1})):u.debug&&console.warn("Pager: >> Size selector not found"),z.initialized=!1,x.triggerHandler("pagerBeforeInitialized",z),A(s,z,!1),"string"==typeof z.ajaxUrl?(z.ajax=!0,u.widgetOptions.filter_serversideFiltering=!0,u.serverSideSorting=!0,R(s,z)):(z.ajax=!1,t.appendCache(u,!0),d(s,z)),z.ajax||z.initialized||(z.initializing=!1,z.initialized=!0,P(s,z.size,z),R(s,z),u.debug&&console.log("Pager: Triggering pagerInitialized"),u.$table.triggerHandler("pagerInitialized",z),u.widgetOptions.filter_initialized&&t.hasWidget(s,"filter")||o(s,z,!1)),u.widgetInit.pager=!0};i.appender=function(t,a){var i=t.config,s=i.pager;s.ajax||(i.rowsCopy=a,s.totalRows=s.countChildRows?i.$tbodies.eq(0).children("tr").length:a.length,s.size=e.data(t,"pagerLastSize")||s.size||s.settings.size||10,s.totalPages="all"===s.size?1:Math.ceil(s.totalRows/s.size),h(t,a,s),o(t,s,!1))},i.construct=function(e){return this.each(function(){this.config&&this.hasInitialized&&F(this,e)})}}}),t.showError=function(t,a,i,s){var r=e(t),o=r[0].config,n=o&&o.widgetOptions,l=o.pager&&o.pager.cssErrorRow||n&&n.pager_css&&n.pager_css.errorRow||"tablesorter-errorRow",g=typeof a,c=!0,d="",p=function(){o.$table.find("thead").find("."+l).remove()};if(r.length){if("function"==typeof o.pager.ajaxError){if(!1===(c=o.pager.ajaxError(o,a,i,s)))return p();d=c}else if("function"==typeof n.pager_ajaxError){if(!1===(c=n.pager_ajaxError(o,a,i,s)))return p();d=c}if(""===d)if("object"===g)d=0===a.status?"Not connected, verify Network":404===a.status?"Requested page not found [404]":500===a.status?"Internal Server Error [500]":"parsererror"===s?"Requested JSON parse failed":"timeout"===s?"Time out error":"abort"===s?"Ajax Request aborted":"Uncaught error: "+a.statusText+" ["+a.status+"]";else{if("string"!==g)return p();d=a}e(/tr\>/.test(d)?d:''+d+"").click(function(){e(this).remove()}).appendTo(o.$table.find("thead:first")).addClass(l+" "+o.selectorRemove.slice(1)).attr({role:"alert","aria-live":"assertive"})}else console.error("tablesorter showError: no table parameter passed")},e.fn.extend({tablesorterPager:e.tablesorterPager.construct})}(jQuery); \ No newline at end of file +!function(e){"use strict";var t=e.tablesorter;e.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(e,t){return t},ajaxError:null,ajaxObject:{dataType:"json"},processAjaxOnInit:!0,ajaxProcessing:function(e){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 a="filterInit filterStart filterEnd sortEnd disablePager enablePager destroyPager updateComplete pageSize pageSet pageAndSize pagerUpdate refreshComplete ",i=this,s=function(e,t,a){var i,s="addClass",r="removeClass",o=t.cssDisabled,n=!!a,l=n||0===t.page,g=z(e,t),c=n||t.page===g-1||0===g;t.updateArrows&&((i=t.$container.find(t.cssFirst+","+t.cssPrev))[l?s:r](o),i.each(function(){this.ariaDisabled=l}),(i=t.$container.find(t.cssNext+","+t.cssLast))[c?s:r](o),i.each(function(){this.ariaDisabled=c}))},r=function(e,a){var i,s,r,o=e.config,n=o.$table.hasClass("hasFilters");if(n&&!a.ajax)if(t.isEmptyObject(o.cache))a.filteredRows=a.totalRows=o.$tbodies.eq(0).children("tr").not(a.countChildRows?"":"."+o.cssChildRow).length;else for(a.filteredRows=0,r=(i=o.cache[0].normalized).length,s=0;s=0){if(c=P*i.page>i.filteredRows&&o,i.page=c?i.pageReset||0:i.page,i.startRow=c?P*i.page+1:0===i.filteredRows?0:P*i.page+1,i.endRow=Math.min(i.filteredRows,i.totalRows,P*(i.page+1)),d=i.$container.find(i.cssPageDisplay),"function"==typeof i.output?g=i.output(a,i):(w=d.attr("data-pager-output"+(i.filteredRows'):r.length>1&&o&&o[r[0]]?o[r[0]][r[1]]:i[s]||(o?o[s]:n)||n})),(p=i.$container.find(i.cssGoto)).length){for(c="",u=(h=n(a,i)).length,f=0;f'+h[f]+"";p.html(c).val(i.page+1)}d.length&&(d["INPUT"===d[0].nodeName?"val":"html"](g),d.find(".ts-startRow, .ts-page").unbind("change"+R).bind("change"+R,function(){var t=e(this).val(),a=e(this).hasClass("ts-startRow")?Math.floor(t/P)+1:t;b.$table.triggerHandler("pageSet"+R,[a])}))}s(a,i),l(a,i),i.initialized&&!1!==o&&(b.debug&&console.log("Pager: Triggering pagerComplete"),b.$table.triggerHandler("pagerComplete",i),i.savePages&&t.storage&&t.storage(a,i.storageKey,{page:i.page,size:P===i.totalRows?"all":P}))}},n=function(t,a){var i,s,r,o,n,l,g=z(t,a)||1,c=5*Math.ceil(g/a.maxOptionSize/5),d=g>a.maxOptionSize,p=a.page+1,f=c,u=g-c,h=[1];for(i=d?c:1;i<=g;)h[h.length]=i,i+=d?c:1;if(h[h.length]=g,d){for(r=[],(f=p-(s=Math.max(Math.floor(a.maxOptionSize/c)-1,5)))<1&&(f=1),(u=p+s)>g&&(u=g),i=f;i<=u;i++)r[r.length]=i;(n=(h=e.grep(h,function(t,a){return e.inArray(t,h)===a})).length)-(l=r.length)>c/2&&n+l>a.maxOptionSize&&(o=Math.floor(n/2)-Math.floor(l/2),Array.prototype.splice.apply(h,[o,l])),h=h.concat(r)}return h=e.grep(h,function(t,a){return e.inArray(t,h)===a}).sort(function(e,t){return e-t})},l=function(t,a){var i,s,r,o=t.config,n=o.$tbodies.eq(0);n.find("tr.pagerSavedHeightSpacer").remove(),a.fixedHeight&&!a.isDisabled&&(s=e.data(t,"pagerSavedHeight"))&&(r=0,e(t).css("border-spacing").split(" ").length>1&&(r=e(t).css("border-spacing").split(" ")[1].replace(/[^-\d\.]/g,"")),(i=s-n.height()+r*a.size-r)>5&&e.data(t,"pagerLastSize")===a.size&&n.children("tr:visible").length<("all"===a.size?a.totalRows:a.size)&&n.append(''))},g=function(t,a){var i,s=t.config,r=s.$tbodies.eq(0);r.find("tr.pagerSavedHeightSpacer").remove(),r.children("tr:visible").length||r.append(' '),i=r.children("tr").eq(0).height()*("all"===a.size?a.totalRows:a.size),e.data(t,"pagerSavedHeight",i),l(t,a),e.data(t,"pagerLastSize",a.size)},c=function(e,a){if(!a.ajaxUrl){var i,s=0,r=e.config,o=r.$tbodies.eq(0).children("tr"),n=o.length,l="all"===a.size?a.totalRows:a.size,g=a.page*l,c=g+l,d=0,p=0;for(a.cacheIndex=[],i=0;i=g&&p=g&&p0&&o[s].className.match(t.css.cssHasChild))for(;++s> Ajax Error",r,n,l),t.showError(i,r,n,l),y.$tbodies.eq(0).children("tr").detach(),s.totalRows=0;else{if(e.isArray(I)?(P=I[(d=isNaN(I[0])&&!isNaN(I[1]))?1:0],s.totalRows=isNaN(P)?s.totalRows||0:P,y.totalRows=y.filteredRows=s.filteredRows=s.totalRows,z=0===s.totalRows?[]:I[d?0:1]||[],R=I[2]):(s.ajaxData=I,y.totalRows=s.totalRows=I.total,y.filteredRows=s.filteredRows=void 0!==I.filteredRows?I.filteredRows:I.total,R=I.headers,z=I.rows||[]),x=z&&z.length,z instanceof jQuery)s.processAjaxOnInit&&(y.$tbodies.eq(0).empty(),y.$tbodies.eq(0).append(z));else if(x){for(g=0;g",c=0;c"+z[g][c]+"";$+=""}s.processAjaxOnInit&&y.$tbodies.eq(0).html($)}if(s.processAjaxOnInit=!0,R)for(u=(p=C.hasClass("hasStickyHeaders"))?y.widgetOptions.$sticky.children("thead:first").children("tr:not(."+y.cssIgnoreRow+")").children():"",f=C.find("tfoot tr:first").children(),v=(h=y.$headers.filter("th ")).length,c=0;c> No rows for pager to render");else{if(s.page>=s.totalPages&&m(a,s),s.cacheIndex=[],s.isDisabled=!1,s.initialized&&(p.debug&&console.log("Pager: Triggering pagerChange"),d.triggerHandler("pagerChange",s)),s.removeRows){for(t.clearTableBody(a),r=t.processTbody(a,p.$tbodies.eq(0),!0),n=f?0:w,l=f?0:w,g=0;gw&&g<=h&&(g++,s.cacheIndex[s.cacheIndex.length]=n,r.append(i[n])),n++;t.processTbody(a,r,!1)}else c(a,s);o(a,s),a.isUpdating&&(p.debug&&console.log("Pager: Triggering updateComplete"),d.triggerHandler("updateComplete",[a,!0]))}},w=function(a,i){var r,o,n;for(i.ajax?s(a,i,!0):(e.data(a,"pagerLastPage",i.page),e.data(a,"pagerLastSize",i.size),i.page=0,i.size=i.totalPages,i.totalPages=1,e(a).addClass("pagerDisabled").removeAttr("aria-describedby").find("tr.pagerSavedHeightSpacer").remove(),h(a,a.config.rowsCopy,i),i.isDisabled=!0,t.applyWidget(a),a.config.debug&&console.log("Pager: Disabled")),n=(o=i.$container.find(i.cssGoto+","+i.cssPageSize+", .ts-startRow, .ts-page")).length,r=0;ra&&a>=0&&(t.page=a),t.page},j=function(e,t,a){var i=parseInt(t,10)||e.size||e.settings.size||10;return e.initialized&&(/all/i.test(i+" "+t)||i===e.totalRows)?e.$container.find(e.cssPageSize+' option[value="all"]').length?"all":e.totalRows:"get"===a?i:e.size},P=function(t,a,i){i.size=j(i,a,"get"),i.$container.find(i.cssPageSize).val(i.size),e.data(t,"pagerLastPage",x(t,i)),e.data(t,"pagerLastSize",i.size),i.totalPages="all"===i.size?1:Math.ceil(i.totalRows/i.size),i.filteredPages="all"===i.size?1:Math.ceil(i.filteredRows/i.size)},v=function(e,t){t.page=0,R(e,t)},m=function(e,t){t.page=z(e,t)-1,R(e,t)},y=function(e,t){t.page++;var a=z(e,t)-1;t.page>=a&&(t.page=a),R(e,t)},C=function(e,t){--t.page<=0&&(t.page=0),R(e,t)},S=function(a,i){i.initialized=!0,i.initializing=!1,a.config.debug&&console.log("Pager: Triggering pagerInitialized"),e(a).triggerHandler("pagerInitialized",i),t.applyWidget(a),o(a,i)},$=function(t,a){t.config.pager=e.extend(!0,{},e.tablesorterPager.defaults,a.settings),F(t,a.settings)},I=function(e,a){var i=e.config,s=i.namespace+"pager",r=[a.cssFirst,a.cssPrev,a.cssNext,a.cssLast,a.cssGoto,a.cssPageSize].join(",");w(e,a),a.$container.hide().find(r).unbind(s),i.appender=null,i.$table.unbind(s),t.storage&&t.storage(e,a.storageKey,""),delete i.pager,delete i.rowsCopy},A=function(a,i,s){var r,o,n,l=a.config;i.$container.find(i.cssGoto+","+i.cssPageSize+",.ts-startRow, .ts-page").removeClass(i.cssDisabled).removeAttr("disabled").each(function(){this.ariaDisabled=!1}),i.isDisabled=!1,i.page=e.data(a,"pagerLastPage")||i.page||0,o=(n=i.$container.find(i.cssPageSize)).find("option[selected]").val(),i.size=e.data(a,"pagerLastSize")||j(i,o,"get"),i.totalPages="all"===i.size?1:Math.ceil(z(a,i)/i.size),P(a,i.size,i),a.id&&!l.$table.attr("aria-describedby")&&((r=(n=i.$container.find(i.cssPageDisplay)).attr("id"))||(r=a.id+"_pager_info",n.attr("id",r)),l.$table.attr("aria-describedby",r)),g(a,i),s&&(t.update(l),P(a,i.size,i),R(a,i),d(a,i),l.debug&&console.log("Pager: Enabled"))},F=function(s,r){var n,l,p,f,u=s.config,h=u.widgetOptions,z=u.pager=e.extend(!0,{},e.tablesorterPager.defaults,r),x=u.$table,S=u.namespace+"pager",F=z.$container=e(z.container).addClass("tablesorter-pager").show();z.settings=e.extend(!0,{},e.tablesorterPager.defaults,r),u.debug&&console.log("Pager: Initializing"),z.oldAjaxSuccess=z.oldAjaxSuccess||z.ajaxObject.success,u.appender=i.appender,z.initializing=!0,z.savePages&&t.storage&&(n=t.storage(s,z.storageKey)||{},z.page=isNaN(n.page)?z.page:n.page,z.size="all"===n.size?n.size:(isNaN(n.size)?z.size:n.size)||z.setSize||10,P(s,z.size,z)),z.regexRows=new RegExp("("+(h.filter_filteredRow||"filtered")+"|"+u.selectorRemove.slice(1)+"|"+u.cssChildRow+")"),z.regexFiltered=new RegExp(h.filter_filteredRow||"filtered"),x.unbind(a.split(" ").join(S+" ").replace(/\s+/g," ")).bind("filterInit filterStart ".split(" ").join(S+" "),function(a,i){z.currentFilters=e.isArray(i)?i:u.$table.data("lastSearch");var r;if(z.ajax&&"filterInit"===a.type)return R(s,z,!1);r=t.filter.equalFilters?t.filter.equalFilters(u,u.lastSearch,z.currentFilters):(u.lastSearch||[]).join("")!==(z.currentFilters||[]).join(""),"filterStart"!==a.type||!1===z.pageReset||r||(z.page=z.pageReset)}).bind("filterEnd sortEnd ".split(" ").join(S+" "),function(){z.currentFilters=u.$table.data("lastSearch"),(z.initialized||z.initializing)&&(u.delayInit&&u.rowsCopy&&0===u.rowsCopy.length&&b(s),o(s,z,!1),R(s,z,!1),t.applyWidget(s))}).bind("disablePager"+S,function(e){e.stopPropagation(),w(s,z)}).bind("enablePager"+S,function(e){e.stopPropagation(),A(s,z,!0)}).bind("destroyPager"+S,function(e){e.stopPropagation(),I(s,z)}).bind("resetToLoadState"+S,function(e){e.stopPropagation(),$(s,z)}).bind("updateComplete"+S,function(e,t,a){if(e.stopPropagation(),t&&!a&&!z.ajax){var i=u.$tbodies.eq(0).children("tr").not(u.selectorRemove);z.totalRows=i.length-(z.countChildRows?0:i.filter("."+u.cssChildRow).length),z.totalPages="all"===z.size?1:Math.ceil(z.totalRows/z.size),i.length&&u.rowsCopy&&0===u.rowsCopy.length&&b(t),z.page>=z.totalPages&&m(t,z),c(t,z),g(t,z),o(t,z,!0)}}).bind("pageSize refreshComplete ".split(" ").join(S+" "),function(e,t){e.stopPropagation(),P(s,j(z,t,"get"),z),R(s,z),c(s,z),o(s,z,!1)}).bind("pageSet pagerUpdate ".split(" ").join(S+" "),function(e,t){e.stopPropagation(),"pagerUpdate"===e.type&&(t=void 0===t?z.page+1:t,z.last.page=!0),z.page=(parseInt(t,10)||1)-1,R(s,z,!0),o(s,z,!1)}).bind("pageAndSize"+S,function(e,t,a){e.stopPropagation(),z.page=(parseInt(t,10)||1)-1,P(s,j(z,a,"get"),z),R(s,z,!0),c(s,z),o(s,z,!1)}),l=[z.cssFirst,z.cssPrev,z.cssNext,z.cssLast],p=[v,C,y,m],u.debug&&!F.length&&console.warn("Pager: >> Container not found"),F.find(l.join(",")).attr("tabindex",0).unbind("click"+S).bind("click"+S,function(t){t.stopPropagation();var a,i=e(this),r=l.length;if(!i.hasClass(z.cssDisabled))for(a=0;a> Goto selector not found"),(f=F.find(z.cssPageSize)).length?(f.find("option").removeAttr("selected"),f.unbind("change"+S).bind("change"+S,function(){if(!e(this).hasClass(z.cssDisabled)){var t=e(this).val();P(s,t,z),R(s,z),g(s,z)}return!1})):u.debug&&console.warn("Pager: >> Size selector not found"),z.initialized=!1,x.triggerHandler("pagerBeforeInitialized",z),A(s,z,!1),"string"==typeof z.ajaxUrl?(z.ajax=!0,u.widgetOptions.filter_serversideFiltering=!0,u.serverSideSorting=!0,R(s,z)):(z.ajax=!1,t.appendCache(u,!0),d(s,z)),z.ajax||z.initialized||(z.initializing=!1,z.initialized=!0,P(s,z.size,z),R(s,z),u.debug&&console.log("Pager: Triggering pagerInitialized"),u.$table.triggerHandler("pagerInitialized",z),u.widgetOptions.filter_initialized&&t.hasWidget(s,"filter")||o(s,z,!1)),u.widgetInit.pager=!0};i.appender=function(t,a){var i=t.config,s=i.pager;s.ajax||(i.rowsCopy=a,s.totalRows=s.countChildRows?i.$tbodies.eq(0).children("tr").length:a.length,s.size=e.data(t,"pagerLastSize")||s.size||s.settings.size||10,s.totalPages="all"===s.size?1:Math.ceil(s.totalRows/s.size),h(t,a,s),o(t,s,!1))},i.construct=function(e){return this.each(function(){this.config&&this.hasInitialized&&F(this,e)})}}}),t.showError=function(t,a,i,s){var r=e(t),o=r[0].config,n=o&&o.widgetOptions,l=o.pager&&o.pager.cssErrorRow||n&&n.pager_css&&n.pager_css.errorRow||"tablesorter-errorRow",g=typeof a,c=!0,d="",p=function(){o.$table.find("thead").find(o.selectorRemove).remove()};if(r.length){if("function"==typeof o.pager.ajaxError){if(!1===(c=o.pager.ajaxError(o,a,i,s)))return p();d=c}else if("function"==typeof n.pager_ajaxError){if(!1===(c=n.pager_ajaxError(o,a,i,s)))return p();d=c}if(""===d)if("object"===g)d=0===a.status?"Not connected, verify Network":404===a.status?"Requested page not found [404]":500===a.status?"Internal Server Error [500]":"parsererror"===s?"Requested JSON parse failed":"timeout"===s?"Time out error":"abort"===s?"Ajax Request aborted":"Uncaught error: "+a.statusText+" ["+a.status+"]";else{if("string"!==g)return p();d=a}e(/tr\>/.test(d)?d:''+d+"").click(function(){e(this).remove()}).appendTo(o.$table.find("thead:first")).addClass(l+" "+o.selectorRemove.slice(1)).attr({role:"alert","aria-live":"assertive"})}else console.error("tablesorter showError: no table parameter passed")},e.fn.extend({tablesorterPager:e.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 6afa3260..80e66fd1 100644 --- a/dist/js/widgets/widget-pager.min.js +++ b/dist/js/widgets/widget-pager.min.js @@ -1,2 +1,2 @@ /*! Widget: Pager - updated 5/24/2017 (v2.28.11) */ -!function(e){"use strict";var a,t=e.tablesorter;t.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(e,a){return a},pager_ajaxError:null,pager_ajaxObject:{dataType:"json"},pager_processAjaxOnInit:!0,pager_ajaxProcessing:function(e){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(e){a.init(e)},format:function(e,t){if(!t.pager||!t.pager.initialized)return a.initComplete(t);a.moveToPage(t,t.pager,!1)},remove:function(e,t,r,i){a.destroyPager(t,i)}}),a=t.pager={init:function(r){if(!(r.hasInitialized&&r.config.pager&&r.config.pager.initialized)){var i,s=r.config,o=s.widgetOptions,g=o.pager_selectors,n=s.pager=e.extend({totalPages:0,filteredRows:0,filteredPages:0,currentFilters:[],page:o.pager_startPage,startRow:0,endRow:0,ajaxCounter:0,$size:null,last:{},setSize:o.pager_size,setPage:o.pager_startPage},s.pager);n.isInitializing||(n.isInitializing=!0,s.debug&&console.log("Pager: Initializing"),n.size=e.data(r,"pagerLastSize")||o.pager_size,n.$container=e(g.container).addClass(o.pager_css.container).show(),n.totalRows=s.$tbodies.eq(0).children("tr").not(o.pager_countChildRows?"":"."+s.cssChildRow).length,n.oldAjaxSuccess=n.oldAjaxSuccess||o.pager_ajaxObject.success,s.appender=a.appender,n.initializing=!0,o.pager_savePages&&t.storage&&(i=t.storage(r,o.pager_storageKey)||{},n.page=(isNaN(i.page)?n.page:i.page)||n.setPage||0,n.size="all"===i.size?i.size:(isNaN(i.size)?n.size:i.size)||n.setSize||10,a.setPageSize(s,n.size)),n.regexRows=new RegExp("("+(o.filter_filteredRow||"filtered")+"|"+s.selectorRemove.slice(1)+"|"+s.cssChildRow+")"),n.regexFiltered=new RegExp(o.filter_filteredRow||"filtered"),n.initialized=!1,s.$table.triggerHandler("pagerBeforeInitialized",s),a.enablePager(s,!1),n.ajaxObject=o.pager_ajaxObject,n.ajaxObject.url=o.pager_ajaxUrl,"string"==typeof o.pager_ajaxUrl?(n.ajax=!0,o.filter_serversideFiltering=!0,s.serverSideSorting=!0,a.moveToPage(s,n)):(n.ajax=!1,t.appendCache(s,!0)))}},initComplete:function(e){var r=e.pager;a.bindEvents(e),r.ajax||a.hideRowsSetup(e),r.initialized=!0,r.initializing=!1,r.isInitializing=!1,a.setPageSize(e,r.size),e.debug&&console.log("Pager: Triggering pagerInitialized"),e.$table.triggerHandler("pagerInitialized",e),e.widgetOptions.filter_initialized&&t.hasWidget(e.table,"filter")||a.updatePageDisplay(e,!r.ajax)},bindEvents:function(r){var i,s,o,g=r.pager,n=r.widgetOptions,l=r.namespace+"pager",p=n.pager_selectors;r.$table.off(l).on("filterInit filterStart ".split(" ").join(l+" "),function(i,s){g.currentFilters=e.isArray(s)?s:r.$table.data("lastSearch");var o;if(g.ajax&&"filterInit"===i.type)return a.moveToPage(r,g,!1);o=t.filter.equalFilters?t.filter.equalFilters(r,r.lastSearch,g.currentFilters):(r.lastSearch||[]).join("")!==(g.currentFilters||[]).join(""),"filterStart"!==i.type||!1===n.pager_pageReset||o||(g.page=n.pager_pageReset)}).on("filterEnd sortEnd ".split(" ").join(l+" "),function(){g.currentFilters=r.$table.data("lastSearch"),(g.initialized||g.initializing)&&(r.delayInit&&r.rowsCopy&&0===r.rowsCopy.length&&a.updateCache(r),a.updatePageDisplay(r,!1),t.applyWidget(r.table))}).on("disablePager"+l,function(e){e.stopPropagation(),a.showAllRows(r)}).on("enablePager"+l,function(e){e.stopPropagation(),a.enablePager(r,!0)}).on("destroyPager"+l,function(e,a){e.stopPropagation(),t.removeWidget(r.table,"pager",!1)}).on("updateComplete"+l,function(e,i,s){if(e.stopPropagation(),i&&!s&&!g.ajax){var o=r.$tbodies.eq(0).children("tr").not(r.selectorRemove);g.totalRows=o.length-(n.pager_countChildRows?0:o.filter("."+r.cssChildRow).length),g.totalPages="all"===g.size?1:Math.ceil(g.totalRows/g.size),o.length&&r.rowsCopy&&0===r.rowsCopy.length&&a.updateCache(r),g.page>=g.totalPages&&a.moveToLastPage(r,g),a.hideRows(r),a.changeHeight(r),a.updatePageDisplay(r,!1),t.applyWidget(i),a.updatePageDisplay(r)}}).on("pageSize refreshComplete ".split(" ").join(l+" "),function(e,t){e.stopPropagation(),a.setPageSize(r,a.parsePageSize(r,t,"get")),a.moveToPage(r,g,!0),a.hideRows(r),a.updatePageDisplay(r,!1)}).on("pageSet pagerUpdate ".split(" ").join(l+" "),function(e,t){e.stopPropagation(),"pagerUpdate"===e.type&&(t=void 0===t?g.page+1:t,g.last.page=!0),g.page=(parseInt(t,10)||1)-1,a.moveToPage(r,g,!0),a.updatePageDisplay(r,!1)}).on("pageAndSize"+l,function(e,t,i){e.stopPropagation(),g.page=(parseInt(t,10)||1)-1,a.setPageSize(r,a.parsePageSize(r,i,"get")),a.moveToPage(r,g,!0),a.hideRows(r),a.updatePageDisplay(r,!1)}),i=[p.first,p.prev,p.next,p.last],s=["moveToFirstPage","moveToPrevPage","moveToNextPage","moveToLastPage"],r.debug&&!g.$container.length&&console.warn("Pager: >> Container not found"),g.$container.find(i.join(",")).attr("tabindex",0).off("click"+l).on("click"+l,function(t){t.stopPropagation();var o,l=e(this),p=i.length;if(!l.hasClass(n.pager_css.disabled))for(o=0;o> Goto selector not found"),(o=g.$container.find(n.pager_selectors.pageSize)).length?(o.find("option").removeAttr("selected"),o.off("change"+l).on("change"+l,function(){if(!e(this).hasClass(n.pager_css.disabled)){var t=e(this).val();g.$container.find(n.pager_selectors.pageSize).val(t),a.setPageSize(r,t),a.moveToPage(r,g,!0),a.changeHeight(r)}return!1})):r.debug&&console.warn("Pager: >> Size selector not found")},pagerArrows:function(e,t){var r=e.pager,i=!!t,s=i||0===r.page,o=a.getTotalPages(e,r),g=i||r.page===o-1||0===o,n=e.widgetOptions,l=n.pager_selectors;n.pager_updateArrows&&(r.$container.find(l.first+","+l.prev).toggleClass(n.pager_css.disabled,s).prop("aria-disabled",s),r.$container.find(l.next+","+l.last).toggleClass(n.pager_css.disabled,g).prop("aria-disabled",g))},calcFilters:function(a){var t,r,i,s=a.widgetOptions,o=a.pager,g=a.$table.hasClass("hasFilters");if(g&&!o.ajax)if(e.isEmptyObject(a.cache))o.filteredRows=o.totalRows=a.$tbodies.eq(0).children("tr").not(s.pager_countChildRows?"":"."+a.cssChildRow).length;else for(o.filteredRows=0,i=(t=a.cache[0].normalized).length,r=0;r=0){if(o=w*u.page>u.filteredRows&&i,u.page=o?f.pager_pageReset||0:u.page,u.startRow=o?w*u.page+1:0===u.filteredRows?0:w*u.page+1,u.endRow=Math.min(u.filteredRows,u.totalRows,w*(u.page+1)),g=u.$container.find(f.pager_selectors.pageDisplay),"function"==typeof f.pager_output?s=f.pager_output(c,u):(d=g.attr("data-pager-output"+(u.filteredRows'):i.length>1&&s&&s[i[0]]?s[i[0]][i[1]]:u[r]||(s?s[r]:o)||o})),u.$container.find(f.pager_selectors.gotoPage).length){for(o="",p=(n=a.buildPageSelect(r,u)).length,l=0;l'+n[l]+"";u.$container.find(f.pager_selectors.gotoPage).html(o).val(u.page+1)}g.length&&(g["INPUT"===g[0].nodeName?"val":"html"](s),g.find(".ts-startRow, .ts-page").off("change"+h).on("change"+h,function(){var a=e(this).val(),t=e(this).hasClass("ts-startRow")?Math.floor(a/w)+1:a;r.$table.triggerHandler("pageSet"+h,[t])}))}a.pagerArrows(r),a.fixHeight(r),u.initialized&&!1!==i&&(r.debug&&console.log("Pager: Triggering pagerComplete"),r.$table.triggerHandler("pagerComplete",r),f.pager_savePages&&t.storage&&t.storage(c,f.pager_storageKey,{page:u.page,size:w===u.totalRows?"all":w}))}},buildPageSelect:function(t,r){var i,s,o,g,n,l,p=t.widgetOptions,d=a.getTotalPages(t,r)||1,c=5*Math.ceil(d/p.pager_maxOptionSize/5),f=d>p.pager_maxOptionSize,u=r.page+1,h=c,w=d-c,P=[1];for(i=f?c:1;i<=d;)P[P.length]=i,i+=f?c:1;if(P[P.length]=d,f){for(o=[],(h=u-(s=Math.max(Math.floor(p.pager_maxOptionSize/c)-1,5)))<1&&(h=1),(w=u+s)>d&&(w=d),i=h;i<=w;i++)o[o.length]=i;(n=(P=e.grep(P,function(a,t){return e.inArray(a,P)===t})).length)-(l=o.length)>c/2&&n+l>p.pager_maxOptionSize&&(g=Math.floor(n/2)-Math.floor(l/2),Array.prototype.splice.apply(P,[g,l])),P=P.concat(o)}return P=e.grep(P,function(a,t){return e.inArray(a,P)===t}).sort(function(e,a){return e-a})},fixHeight:function(a){var t,r,i=a.table,s=a.pager,o=a.widgetOptions,g=a.$tbodies.eq(0);g.find("tr.pagerSavedHeightSpacer").remove(),o.pager_fixedHeight&&!s.isDisabled&&(r=e.data(i,"pagerSavedHeight"))&&(t=r-g.height())>5&&e.data(i,"pagerLastSize")===s.size&&g.children("tr:visible").length<("all"===s.size?s.totalRows:s.size)&&g.append('')},changeHeight:function(t){var r,i=t.table,s=t.pager,o="all"===s.size?s.totalRows:s.size,g=t.$tbodies.eq(0);g.find("tr.pagerSavedHeightSpacer").remove(),g.children("tr:visible").length||g.append(' '),r=g.children("tr").eq(0).height()*o,e.data(i,"pagerSavedHeight",r),a.fixHeight(t),e.data(i,"pagerLastSize",s.size)},hideRows:function(e){if(!e.widgetOptions.pager_ajaxUrl){e.table;var a,r,i,s,o,g=e.pager,n=e.widgetOptions,l=e.$tbodies.length,p="all"===g.size?g.totalRows:g.size,d=g.page*p,c=d+p,f=0,u=0;for(g.cacheIndex=[],a=0;a=d&&u=d&&u0&&i[o].className.match(t.css.cssHasChild))for(;++o> Ajax Error",s,o,g),t.showError(n,s,o,g),i.$tbodies.eq(0).children("tr").detach(),l.totalRows=0;else{if(e.isArray(C)?(j=C[(f=isNaN(C[0])&&!isNaN(C[1]))?1:0],l.totalRows=isNaN(j)?l.totalRows||0:j,i.totalRows=i.filteredRows=l.filteredRows=l.totalRows,v=0===l.totalRows?[]:C[f?0:1]||[],R=C[2]):(l.ajaxData=C,i.totalRows=l.totalRows=C.total,i.filteredRows=l.filteredRows=void 0!==C.filteredRows?C.filteredRows:C.total,R=C.headers,v=C.rows||[]),m=v&&v.length,v instanceof jQuery)p.pager_processAjaxOnInit&&(i.$tbodies.eq(0).empty(),i.$tbodies.eq(0).append(v));else if(m){for(d=0;d",c=0;c"+v[d][c]+"";S+=""}p.pager_processAjaxOnInit&&i.$tbodies.eq(0).html(S)}if(p.pager_processAjaxOnInit=!0,R){for(w=(u=y.hasClass("hasStickyHeaders"))?p.$sticky.children("thead:first").children("tr:not(."+i.cssIgnoreRow+")").children():"",h=y.find("tfoot tr:first").children(),x=(P=i.$headers.filter("th")).length,c=0;c> No rows for pager to render");else{if(l.page>=l.totalPages)return a.moveToLastPage(e,l);if(l.cacheIndex=[],l.isDisabled=!1,l.initialized&&(e.debug&&console.log("Pager: Triggering pagerChange"),e.$table.triggerHandler("pagerChange",e)),p.pager_removeRows){for(t.clearTableBody(n),i=t.processTbody(n,e.$tbodies.eq(0),!0),s=d?0:u,o=d?0:u,g=0;gu&&g<=f&&(g++,l.cacheIndex[l.cacheIndex.length]=s,i.append(r[s])),s++;t.processTbody(n,i,!1)}else a.hideRows(e);a.updatePageDisplay(e),p.pager_startPage=l.page,p.pager_size=l.size,n.isUpdating&&(e.debug&&console.log("Pager: Triggering updateComplete"),e.$table.triggerHandler("updateComplete",[n,!0]))}},showAllRows:function(r){var i,s,o,g=r.table,n=r.pager,l=r.widgetOptions;for(n.ajax?a.pagerArrows(r,!0):(e.data(g,"pagerLastPage",n.page),e.data(g,"pagerLastSize",n.size),n.page=0,n.size=n.totalPages,n.totalPages=1,r.$table.addClass("pagerDisabled").removeAttr("aria-describedby").find("tr.pagerSavedHeightSpacer").remove(),a.renderTable(r,r.rowsCopy),n.isDisabled=!0,t.applyWidget(g),r.debug&&console.log("Pager: Disabled")),o=(s=n.$container.find(l.pager_selectors.pageSize+","+l.pager_selectors.gotoPage+",.ts-startRow, .ts-page")).length,i=0;ir&&r>=0&&(t.page=r),t.page},parsePageSize:function(e,a,t){var r=e.pager,i=e.widgetOptions,s=parseInt(a,10)||r.size||i.pager_size||10;return r.initialized&&(/all/i.test(s+" "+a)||s===r.totalRows)?r.$container.find(i.pager_selectors.pageSize+' option[value="all"]').length?"all":r.totalRows:"get"===t?s:r.size},setPageSize:function(t,r){var i=t.pager,s=t.table;i.size=a.parsePageSize(t,r,"get"),i.$container.find(t.widgetOptions.pager_selectors.pageSize).val(i.size),e.data(s,"pagerLastPage",a.parsePageNumber(t,i)),e.data(s,"pagerLastSize",i.size),i.totalPages="all"===i.size?1:Math.ceil(i.totalRows/i.size),i.filteredPages="all"===i.size?1:Math.ceil(i.filteredRows/i.size)},moveToFirstPage:function(e,t){t.page=0,a.moveToPage(e,t,!0)},moveToLastPage:function(e,t){t.page=a.getTotalPages(e,t)-1,a.moveToPage(e,t,!0)},moveToNextPage:function(e,t){t.page++;var r=a.getTotalPages(e,t)-1;t.page>=r&&(t.page=r),a.moveToPage(e,t,!0)},moveToPrevPage:function(e,t){--t.page<=0&&(t.page=0),a.moveToPage(e,t,!0)},destroyPager:function(e,r){var i=e.table,s=e.pager,o=e.widgetOptions.pager_selectors||{},g=[o.first,o.prev,o.next,o.last,o.gotoPage,o.pageSize].join(","),n=e.namespace+"pager";if(s){if(s.initialized=!1,e.$table.off(n),s.$container.hide().find(g).off(n),r)return;e.appender=null,a.showAllRows(e),t.storage&&t.storage(i,e.widgetOptions.pager_storageKey,""),s.$container=null,e.pager=null,e.rowsCopy=null}},enablePager:function(r,i){var s,o,g=r.table,n=r.pager,l=r.widgetOptions,p=n.$container.find(l.pager_selectors.pageSize);n.isDisabled=!1,n.page=e.data(g,"pagerLastPage")||n.page||0,o=p.find("option[selected]").val(),n.size=e.data(g,"pagerLastSize")||a.parsePageSize(r,o,"get"),a.setPageSize(r,n.size),n.totalPages="all"===n.size?1:Math.ceil(a.getTotalPages(r,n)/n.size),r.$table.removeClass("pagerDisabled"),g.id&&!r.$table.attr("aria-describedby")&&((s=(p=n.$container.find(l.pager_selectors.pageDisplay)).attr("id"))||(s=g.id+"_pager_info",p.attr("id",s)),r.$table.attr("aria-describedby",s)),a.changeHeight(r),i&&(t.update(r),a.setPageSize(r,n.size),a.moveToPage(r,n,!0),a.hideRowsSetup(r),r.debug&&console.log("Pager: Enabled"))},appender:function(t,r){var i=t.config,s=i.widgetOptions,o=i.pager;o.ajax?a.moveToPage(i,o,!0):(i.rowsCopy=r,o.totalRows=s.pager_countChildRows?i.$tbodies.eq(0).children("tr").length:r.length,o.size=e.data(t,"pagerLastSize")||o.size||s.pager_size||o.setSize||10,o.totalPages="all"===o.size?1:Math.ceil(o.totalRows/o.size),a.moveToPage(i,o),a.updatePageDisplay(i,!1))}},t.showError=function(a,t,r,i){var s=e(a),o=s[0].config,g=o&&o.widgetOptions,n=o.pager&&o.pager.cssErrorRow||g&&g.pager_css&&g.pager_css.errorRow||"tablesorter-errorRow",l=typeof t,p=!0,d="",c=function(){o.$table.find("thead").find("."+n).remove()};if(s.length){if("function"==typeof o.pager.ajaxError){if(!1===(p=o.pager.ajaxError(o,t,r,i)))return c();d=p}else if("function"==typeof g.pager_ajaxError){if(!1===(p=g.pager_ajaxError(o,t,r,i)))return c();d=p}if(""===d)if("object"===l)d=0===t.status?"Not connected, verify Network":404===t.status?"Requested page not found [404]":500===t.status?"Internal Server Error [500]":"parsererror"===i?"Requested JSON parse failed":"timeout"===i?"Time out error":"abort"===i?"Ajax Request aborted":"Uncaught error: "+t.statusText+" ["+t.status+"]";else{if("string"!==l)return c();d=t}e(/tr\>/.test(d)?d:''+d+"").click(function(){e(this).remove()}).appendTo(o.$table.find("thead:first")).addClass(n+" "+o.selectorRemove.slice(1)).attr({role:"alert","aria-live":"assertive"})}else console.error("tablesorter showError: no table parameter passed")}}(jQuery); \ No newline at end of file +!function(e){"use strict";var a,t=e.tablesorter;t.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(e,a){return a},pager_ajaxError:null,pager_ajaxObject:{dataType:"json"},pager_processAjaxOnInit:!0,pager_ajaxProcessing:function(e){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(e){a.init(e)},format:function(e,t){if(!t.pager||!t.pager.initialized)return a.initComplete(t);a.moveToPage(t,t.pager,!1)},remove:function(e,t,r,i){a.destroyPager(t,i)}}),a=t.pager={init:function(r){if(!(r.hasInitialized&&r.config.pager&&r.config.pager.initialized)){var i,s=r.config,o=s.widgetOptions,g=o.pager_selectors,n=s.pager=e.extend({totalPages:0,filteredRows:0,filteredPages:0,currentFilters:[],page:o.pager_startPage,startRow:0,endRow:0,ajaxCounter:0,$size:null,last:{},setSize:o.pager_size,setPage:o.pager_startPage},s.pager);n.isInitializing||(n.isInitializing=!0,s.debug&&console.log("Pager: Initializing"),n.size=e.data(r,"pagerLastSize")||o.pager_size,n.$container=e(g.container).addClass(o.pager_css.container).show(),n.totalRows=s.$tbodies.eq(0).children("tr").not(o.pager_countChildRows?"":"."+s.cssChildRow).length,n.oldAjaxSuccess=n.oldAjaxSuccess||o.pager_ajaxObject.success,s.appender=a.appender,n.initializing=!0,o.pager_savePages&&t.storage&&(i=t.storage(r,o.pager_storageKey)||{},n.page=(isNaN(i.page)?n.page:i.page)||n.setPage||0,n.size="all"===i.size?i.size:(isNaN(i.size)?n.size:i.size)||n.setSize||10,a.setPageSize(s,n.size)),n.regexRows=new RegExp("("+(o.filter_filteredRow||"filtered")+"|"+s.selectorRemove.slice(1)+"|"+s.cssChildRow+")"),n.regexFiltered=new RegExp(o.filter_filteredRow||"filtered"),n.initialized=!1,s.$table.triggerHandler("pagerBeforeInitialized",s),a.enablePager(s,!1),n.ajaxObject=o.pager_ajaxObject,n.ajaxObject.url=o.pager_ajaxUrl,"string"==typeof o.pager_ajaxUrl?(n.ajax=!0,o.filter_serversideFiltering=!0,s.serverSideSorting=!0,a.moveToPage(s,n)):(n.ajax=!1,t.appendCache(s,!0)))}},initComplete:function(e){var r=e.pager;a.bindEvents(e),r.ajax||a.hideRowsSetup(e),r.initialized=!0,r.initializing=!1,r.isInitializing=!1,a.setPageSize(e,r.size),e.debug&&console.log("Pager: Triggering pagerInitialized"),e.$table.triggerHandler("pagerInitialized",e),e.widgetOptions.filter_initialized&&t.hasWidget(e.table,"filter")||a.updatePageDisplay(e,!r.ajax)},bindEvents:function(r){var i,s,o,g=r.pager,n=r.widgetOptions,l=r.namespace+"pager",p=n.pager_selectors;r.$table.off(l).on("filterInit filterStart ".split(" ").join(l+" "),function(i,s){g.currentFilters=e.isArray(s)?s:r.$table.data("lastSearch");var o;if(g.ajax&&"filterInit"===i.type)return a.moveToPage(r,g,!1);o=t.filter.equalFilters?t.filter.equalFilters(r,r.lastSearch,g.currentFilters):(r.lastSearch||[]).join("")!==(g.currentFilters||[]).join(""),"filterStart"!==i.type||!1===n.pager_pageReset||o||(g.page=n.pager_pageReset)}).on("filterEnd sortEnd ".split(" ").join(l+" "),function(){g.currentFilters=r.$table.data("lastSearch"),(g.initialized||g.initializing)&&(r.delayInit&&r.rowsCopy&&0===r.rowsCopy.length&&a.updateCache(r),a.updatePageDisplay(r,!1),t.applyWidget(r.table))}).on("disablePager"+l,function(e){e.stopPropagation(),a.showAllRows(r)}).on("enablePager"+l,function(e){e.stopPropagation(),a.enablePager(r,!0)}).on("destroyPager"+l,function(e,a){e.stopPropagation(),t.removeWidget(r.table,"pager",!1)}).on("updateComplete"+l,function(e,i,s){if(e.stopPropagation(),i&&!s&&!g.ajax){var o=r.$tbodies.eq(0).children("tr").not(r.selectorRemove);g.totalRows=o.length-(n.pager_countChildRows?0:o.filter("."+r.cssChildRow).length),g.totalPages="all"===g.size?1:Math.ceil(g.totalRows/g.size),o.length&&r.rowsCopy&&0===r.rowsCopy.length&&a.updateCache(r),g.page>=g.totalPages&&a.moveToLastPage(r,g),a.hideRows(r),a.changeHeight(r),a.updatePageDisplay(r,!1),t.applyWidget(i),a.updatePageDisplay(r)}}).on("pageSize refreshComplete ".split(" ").join(l+" "),function(e,t){e.stopPropagation(),a.setPageSize(r,a.parsePageSize(r,t,"get")),a.moveToPage(r,g,!0),a.hideRows(r),a.updatePageDisplay(r,!1)}).on("pageSet pagerUpdate ".split(" ").join(l+" "),function(e,t){e.stopPropagation(),"pagerUpdate"===e.type&&(t=void 0===t?g.page+1:t,g.last.page=!0),g.page=(parseInt(t,10)||1)-1,a.moveToPage(r,g,!0),a.updatePageDisplay(r,!1)}).on("pageAndSize"+l,function(e,t,i){e.stopPropagation(),g.page=(parseInt(t,10)||1)-1,a.setPageSize(r,a.parsePageSize(r,i,"get")),a.moveToPage(r,g,!0),a.hideRows(r),a.updatePageDisplay(r,!1)}),i=[p.first,p.prev,p.next,p.last],s=["moveToFirstPage","moveToPrevPage","moveToNextPage","moveToLastPage"],r.debug&&!g.$container.length&&console.warn("Pager: >> Container not found"),g.$container.find(i.join(",")).attr("tabindex",0).off("click"+l).on("click"+l,function(t){t.stopPropagation();var o,l=e(this),p=i.length;if(!l.hasClass(n.pager_css.disabled))for(o=0;o> Goto selector not found"),(o=g.$container.find(n.pager_selectors.pageSize)).length?(o.find("option").removeAttr("selected"),o.off("change"+l).on("change"+l,function(){if(!e(this).hasClass(n.pager_css.disabled)){var t=e(this).val();g.$container.find(n.pager_selectors.pageSize).val(t),a.setPageSize(r,t),a.moveToPage(r,g,!0),a.changeHeight(r)}return!1})):r.debug&&console.warn("Pager: >> Size selector not found")},pagerArrows:function(e,t){var r=e.pager,i=!!t,s=i||0===r.page,o=a.getTotalPages(e,r),g=i||r.page===o-1||0===o,n=e.widgetOptions,l=n.pager_selectors;n.pager_updateArrows&&(r.$container.find(l.first+","+l.prev).toggleClass(n.pager_css.disabled,s).prop("aria-disabled",s),r.$container.find(l.next+","+l.last).toggleClass(n.pager_css.disabled,g).prop("aria-disabled",g))},calcFilters:function(a){var t,r,i,s=a.widgetOptions,o=a.pager,g=a.$table.hasClass("hasFilters");if(g&&!o.ajax)if(e.isEmptyObject(a.cache))o.filteredRows=o.totalRows=a.$tbodies.eq(0).children("tr").not(s.pager_countChildRows?"":"."+a.cssChildRow).length;else for(o.filteredRows=0,i=(t=a.cache[0].normalized).length,r=0;r=0){if(o=w*u.page>u.filteredRows&&i,u.page=o?f.pager_pageReset||0:u.page,u.startRow=o?w*u.page+1:0===u.filteredRows?0:w*u.page+1,u.endRow=Math.min(u.filteredRows,u.totalRows,w*(u.page+1)),g=u.$container.find(f.pager_selectors.pageDisplay),"function"==typeof f.pager_output?s=f.pager_output(c,u):(d=g.attr("data-pager-output"+(u.filteredRows'):i.length>1&&s&&s[i[0]]?s[i[0]][i[1]]:u[r]||(s?s[r]:o)||o})),u.$container.find(f.pager_selectors.gotoPage).length){for(o="",p=(n=a.buildPageSelect(r,u)).length,l=0;l'+n[l]+"";u.$container.find(f.pager_selectors.gotoPage).html(o).val(u.page+1)}g.length&&(g["INPUT"===g[0].nodeName?"val":"html"](s),g.find(".ts-startRow, .ts-page").off("change"+h).on("change"+h,function(){var a=e(this).val(),t=e(this).hasClass("ts-startRow")?Math.floor(a/w)+1:a;r.$table.triggerHandler("pageSet"+h,[t])}))}a.pagerArrows(r),a.fixHeight(r),u.initialized&&!1!==i&&(r.debug&&console.log("Pager: Triggering pagerComplete"),r.$table.triggerHandler("pagerComplete",r),f.pager_savePages&&t.storage&&t.storage(c,f.pager_storageKey,{page:u.page,size:w===u.totalRows?"all":w}))}},buildPageSelect:function(t,r){var i,s,o,g,n,l,p=t.widgetOptions,d=a.getTotalPages(t,r)||1,c=5*Math.ceil(d/p.pager_maxOptionSize/5),f=d>p.pager_maxOptionSize,u=r.page+1,h=c,w=d-c,P=[1];for(i=f?c:1;i<=d;)P[P.length]=i,i+=f?c:1;if(P[P.length]=d,f){for(o=[],(h=u-(s=Math.max(Math.floor(p.pager_maxOptionSize/c)-1,5)))<1&&(h=1),(w=u+s)>d&&(w=d),i=h;i<=w;i++)o[o.length]=i;(n=(P=e.grep(P,function(a,t){return e.inArray(a,P)===t})).length)-(l=o.length)>c/2&&n+l>p.pager_maxOptionSize&&(g=Math.floor(n/2)-Math.floor(l/2),Array.prototype.splice.apply(P,[g,l])),P=P.concat(o)}return P=e.grep(P,function(a,t){return e.inArray(a,P)===t}).sort(function(e,a){return e-a})},fixHeight:function(a){var t,r,i,s=a.table,o=a.pager,g=a.widgetOptions,n=a.$tbodies.eq(0);n.find("tr.pagerSavedHeightSpacer").remove(),g.pager_fixedHeight&&!o.isDisabled&&(r=e.data(s,"pagerSavedHeight"))&&(i=0,e(s).css("border-spacing").split(" ").length>1&&(i=e(s).css("border-spacing").split(" ")[1].replace(/[^-\d\.]/g,"")),(t=r-n.height()+i*o.size-i)>5&&e.data(s,"pagerLastSize")===o.size&&n.children("tr:visible").length<("all"===o.size?o.totalRows:o.size)&&n.append(''))},changeHeight:function(t){var r,i=t.table,s=t.pager,o="all"===s.size?s.totalRows:s.size,g=t.$tbodies.eq(0);g.find("tr.pagerSavedHeightSpacer").remove(),g.children("tr:visible").length||g.append(' '),r=g.children("tr").eq(0).height()*o,e.data(i,"pagerSavedHeight",r),a.fixHeight(t),e.data(i,"pagerLastSize",s.size)},hideRows:function(e){if(!e.widgetOptions.pager_ajaxUrl){e.table;var a,r,i,s,o,g=e.pager,n=e.widgetOptions,l=e.$tbodies.length,p="all"===g.size?g.totalRows:g.size,d=g.page*p,c=d+p,f=0,u=0;for(g.cacheIndex=[],a=0;a=d&&u=d&&u0&&i[o].className.match(t.css.cssHasChild))for(;++o> Ajax Error",s,o,g),t.showError(n,s,o,g),i.$tbodies.eq(0).children("tr").detach(),l.totalRows=0;else{if(e.isArray(C)?(j=C[(f=isNaN(C[0])&&!isNaN(C[1]))?1:0],l.totalRows=isNaN(j)?l.totalRows||0:j,i.totalRows=i.filteredRows=l.filteredRows=l.totalRows,v=0===l.totalRows?[]:C[f?0:1]||[],R=C[2]):(l.ajaxData=C,i.totalRows=l.totalRows=C.total,i.filteredRows=l.filteredRows=void 0!==C.filteredRows?C.filteredRows:C.total,R=C.headers,v=C.rows||[]),m=v&&v.length,v instanceof jQuery)p.pager_processAjaxOnInit&&(i.$tbodies.eq(0).empty(),i.$tbodies.eq(0).append(v));else if(m){for(d=0;d",c=0;c"+v[d][c]+"";S+=""}p.pager_processAjaxOnInit&&i.$tbodies.eq(0).html(S)}if(p.pager_processAjaxOnInit=!0,R){for(w=(u=y.hasClass("hasStickyHeaders"))?p.$sticky.children("thead:first").children("tr:not(."+i.cssIgnoreRow+")").children():"",h=y.find("tfoot tr:first").children(),x=(P=i.$headers.filter("th")).length,c=0;c> No rows for pager to render");else{if(l.page>=l.totalPages)return a.moveToLastPage(e,l);if(l.cacheIndex=[],l.isDisabled=!1,l.initialized&&(e.debug&&console.log("Pager: Triggering pagerChange"),e.$table.triggerHandler("pagerChange",e)),p.pager_removeRows){for(t.clearTableBody(n),i=t.processTbody(n,e.$tbodies.eq(0),!0),s=d?0:u,o=d?0:u,g=0;gu&&g<=f&&(g++,l.cacheIndex[l.cacheIndex.length]=s,i.append(r[s])),s++;t.processTbody(n,i,!1)}else a.hideRows(e);a.updatePageDisplay(e),p.pager_startPage=l.page,p.pager_size=l.size,n.isUpdating&&(e.debug&&console.log("Pager: Triggering updateComplete"),e.$table.triggerHandler("updateComplete",[n,!0]))}},showAllRows:function(r){var i,s,o,g=r.table,n=r.pager,l=r.widgetOptions;for(n.ajax?a.pagerArrows(r,!0):(e.data(g,"pagerLastPage",n.page),e.data(g,"pagerLastSize",n.size),n.page=0,n.size=n.totalPages,n.totalPages=1,r.$table.addClass("pagerDisabled").removeAttr("aria-describedby").find("tr.pagerSavedHeightSpacer").remove(),a.renderTable(r,r.rowsCopy),n.isDisabled=!0,t.applyWidget(g),r.debug&&console.log("Pager: Disabled")),o=(s=n.$container.find(l.pager_selectors.pageSize+","+l.pager_selectors.gotoPage+",.ts-startRow, .ts-page")).length,i=0;ir&&r>=0&&(t.page=r),t.page},parsePageSize:function(e,a,t){var r=e.pager,i=e.widgetOptions,s=parseInt(a,10)||r.size||i.pager_size||10;return r.initialized&&(/all/i.test(s+" "+a)||s===r.totalRows)?r.$container.find(i.pager_selectors.pageSize+' option[value="all"]').length?"all":r.totalRows:"get"===t?s:r.size},setPageSize:function(t,r){var i=t.pager,s=t.table;i.size=a.parsePageSize(t,r,"get"),i.$container.find(t.widgetOptions.pager_selectors.pageSize).val(i.size),e.data(s,"pagerLastPage",a.parsePageNumber(t,i)),e.data(s,"pagerLastSize",i.size),i.totalPages="all"===i.size?1:Math.ceil(i.totalRows/i.size),i.filteredPages="all"===i.size?1:Math.ceil(i.filteredRows/i.size)},moveToFirstPage:function(e,t){t.page=0,a.moveToPage(e,t,!0)},moveToLastPage:function(e,t){t.page=a.getTotalPages(e,t)-1,a.moveToPage(e,t,!0)},moveToNextPage:function(e,t){t.page++;var r=a.getTotalPages(e,t)-1;t.page>=r&&(t.page=r),a.moveToPage(e,t,!0)},moveToPrevPage:function(e,t){--t.page<=0&&(t.page=0),a.moveToPage(e,t,!0)},destroyPager:function(e,r){var i=e.table,s=e.pager,o=e.widgetOptions.pager_selectors||{},g=[o.first,o.prev,o.next,o.last,o.gotoPage,o.pageSize].join(","),n=e.namespace+"pager";if(s){if(s.initialized=!1,e.$table.off(n),s.$container.hide().find(g).off(n),r)return;e.appender=null,a.showAllRows(e),t.storage&&t.storage(i,e.widgetOptions.pager_storageKey,""),s.$container=null,e.pager=null,e.rowsCopy=null}},enablePager:function(r,i){var s,o,g=r.table,n=r.pager,l=r.widgetOptions,p=n.$container.find(l.pager_selectors.pageSize);n.isDisabled=!1,n.page=e.data(g,"pagerLastPage")||n.page||0,o=p.find("option[selected]").val(),n.size=e.data(g,"pagerLastSize")||a.parsePageSize(r,o,"get"),a.setPageSize(r,n.size),n.totalPages="all"===n.size?1:Math.ceil(a.getTotalPages(r,n)/n.size),r.$table.removeClass("pagerDisabled"),g.id&&!r.$table.attr("aria-describedby")&&((s=(p=n.$container.find(l.pager_selectors.pageDisplay)).attr("id"))||(s=g.id+"_pager_info",p.attr("id",s)),r.$table.attr("aria-describedby",s)),a.changeHeight(r),i&&(t.update(r),a.setPageSize(r,n.size),a.moveToPage(r,n,!0),a.hideRowsSetup(r),r.debug&&console.log("Pager: Enabled"))},appender:function(t,r){var i=t.config,s=i.widgetOptions,o=i.pager;o.ajax?a.moveToPage(i,o,!0):(i.rowsCopy=r,o.totalRows=s.pager_countChildRows?i.$tbodies.eq(0).children("tr").length:r.length,o.size=e.data(t,"pagerLastSize")||o.size||s.pager_size||o.setSize||10,o.totalPages="all"===o.size?1:Math.ceil(o.totalRows/o.size),a.moveToPage(i,o),a.updatePageDisplay(i,!1))}},t.showError=function(a,t,r,i){var s=e(a),o=s[0].config,g=o&&o.widgetOptions,n=o.pager&&o.pager.cssErrorRow||g&&g.pager_css&&g.pager_css.errorRow||"tablesorter-errorRow",l=typeof t,p=!0,d="",c=function(){o.$table.find("thead").find(o.selectorRemove).remove()};if(s.length){if("function"==typeof o.pager.ajaxError){if(!1===(p=o.pager.ajaxError(o,t,r,i)))return c();d=p}else if("function"==typeof g.pager_ajaxError){if(!1===(p=g.pager_ajaxError(o,t,r,i)))return c();d=p}if(""===d)if("object"===l)d=0===t.status?"Not connected, verify Network":404===t.status?"Requested page not found [404]":500===t.status?"Internal Server Error [500]":"parsererror"===i?"Requested JSON parse failed":"timeout"===i?"Time out error":"abort"===i?"Ajax Request aborted":"Uncaught error: "+t.statusText+" ["+t.status+"]";else{if("string"!==l)return c();d=t}e(/tr\>/.test(d)?d:''+d+"").click(function(){e(this).remove()}).appendTo(o.$table.find("thead:first")).addClass(n+" "+o.selectorRemove.slice(1)).attr({role:"alert","aria-live":"assertive"})}else console.error("tablesorter showError: no table parameter passed")}}(jQuery); \ No newline at end of file diff --git a/js/widgets/widget-pager.js b/js/widgets/widget-pager.js index 3885ae2b..d2ccf0f0 100644 --- a/js/widgets/widget-pager.js +++ b/js/widgets/widget-pager.js @@ -1307,7 +1307,7 @@ valid = true, message = '', removeRow = function() { - c.$table.find( 'thead' ).find( '.' + errorRow ).remove(); + c.$table.find( 'thead' ).find( c.selectorRemove ).remove(); }; if ( !$table.length ) {