2013-03-28 01:01:39 +00:00
|
|
|
;(function(d){d.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(c,a){return a},ajaxProcessing:function(){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,size:10,fixedHeight:!1,removeRows:!1,cssFirst:".first",cssPrev:".prev",cssNext:".next",cssLast:".last",cssGoto:".gotoPage",cssPageDisplay:".pagedisplay",cssPageSize:".pagesize",cssErrorRow:"tablesorter-errorRow",cssDisabled:"disabled",totalRows:0, totalPages:0,filteredRows:0,filteredPages:0};var p=this,s=function(c,a){var b=c.cssDisabled,g=!!a,h=Math.min(c.totalPages,c.filteredPages);c.updateArrows&&(d(c.cssFirst+","+c.cssPrev,c.container)[g||0===c.page?"addClass":"removeClass"](b),d(c.cssNext+","+c.cssLast,c.container)[g||c.page===h-1?"addClass":"removeClass"](b))},t=function(c,a){var b,g,h;b=d(c).hasClass("hasFilters")&&!a.ajaxUrl;a.filteredRows=b?c.config.$tbodies.children("tr:not(.filtered,.remove-me)").length:a.totalRows;a.filteredPages= b?Math.ceil(a.filteredRows/a.size):a.totalPages;if(0<Math.min(a.totalPages,a.filteredPages)&&(h=a.size*a.page>a.filteredRows,a.startRow=h?1:a.size*a.page+1,a.page=h?0:a.page,a.endRow=Math.min(a.filteredRows,a.totalRows,a.size*(a.page+1)),g=d(a.cssPageDisplay,a.container),b=a.output.replace(/\{(page|filteredRows|filteredPages|totalPages|startRow|endRow|totalRows)\}/gi,function(b){return{"{page}":a.page+1,"{filteredRows}":a.filteredRows,"{filteredPages}":a.filteredPages,"{totalPages}":a.totalPages, "{startRow}":a.startRow,"{endRow}":a.endRow,"{totalRows}":a.totalRows}[b]}),g[0]&&(g["INPUT"===g[0].tagName?"val":"html"](b),d(a.cssGoto,a.container).length))){h="";g=Math.min(a.totalPages,a.filteredPages);for(b=1;b<=g;b++)h+="<option>"+b+"</option>";d(a.cssGoto,a.container).html(h).val(a.page+1)}s(a);a.initialized&&d(c).trigger("pagerComplete",a)},u=function(c,a){var b,g=d(c.tBodies[0]);if(a.fixedHeight&&(g.find("tr.pagerSavedHeightSpacer").remove(),b=d.data(c,"pagerSavedHeight")))b-=g.height(), 5<b&&(d.data(c,"pagerLastSize")===a.size&&g.children("tr:visible").length<a.size)&&g.append('<tr class="pagerSavedHeightSpacer '+c.config.selectorRemove.replace(/(tr)?\./g,"")+'" style="height:'+b+'px;"></tr>')},w=function(c,a){var b=d(c.tBodies[0]);b.find("tr.pagerSavedHeightSpacer").remove();d.data(c,"pagerSavedHeight",b.height());u(c,a);d.data(c,"pagerLastSize",a.size)},n=function(c,a){if(!a.ajaxUrl){var b,g=d(c.tBodies).children("tr:not(."+c.config.cssChildRow+")"),h=g.length,e=a.page*a.size, f=e+a.size,k=0;for(b=0;b<h;b++)/filtered/.test(g[b].className)||(g[b].style.display=k>=e&&k<f?"":"none",k++)}},x=function(c,a){a.size=parseInt(d(a.cssPageSize,a.container).find("option[selected]").val(),10)||a.size;d.data(c,"pagerLastSize",a.size);s(a);a.removeRows||(n(c,a),d(c).bind("sortEnd.pager filterEnd.pager",function(){n(c,a)}))},z=function(c,a,b,g){if("function"===typeof b.ajaxProcessing){var h,e,f,k,j=d(a),l=a.config,y=j.find("thead th").length,q="",m='<tr class="'+b.cssErrorRow+" "+l.selectorRemove.replace(/(tr)?\./g, "")+'"><td style="text-align: center;" colspan="'+y+'">'+(g?g.message+" ("+g.name+")":"No rows found")+"</td></tr>",n=b.ajaxProcessing(c)||[0,[]],p=n[1]||[],s=p.length,r=n[2];if(0<s)for(c=0;c<s;c++){q+="<tr>";for(h=0;h<p[c].length;h++)q+="<td>"+p[c][h]+"</td>";q+="</tr>"}r&&r.length===y&&(e=j.hasClass("hasStickyHeaders"),k=j.find("."+(l.widgetOptions&&l.widgetOptions.stickyHeaders||"tablesorter-stickyheader")),f=j.find("tfoot tr:first").children(),j.find("th."+l.cssHeader).each(function(a){var b= d(this),c;b.find("."+l.cssIcon).length?(c=b.find("."+l.cssIcon).clone(!0),b.find(".tablesorter-header-inner").html(r[a]).append(c),e&&k.length&&(c=k.find("th").eq(a).find("."+l.cssIcon).clone(!0),k.find("th").eq(a).find(".tablesorter-header-inner").html(r[a]).append(c))):(b.find(".tablesorter-header-inner").html(r[a]),k.find("th").eq(a).find(".tablesorter-header-inner").html(r[a]));f.eq(a).html(r[a])}));j.find("thead tr."+b.cssErrorRow).remove();g?j.find("thead").append(m):d(a.tBodies[0]).html(q); l.showProcessing&&d.tablesorter.isProces
|