tablesorter/dist/js/widgets/widget-staticRow.min.js
Rob Garrison 7f082fa019 v2.28.10
2017-05-16 15:33:15 -05:00

2 lines
1.4 KiB
JavaScript

/*! widget: staticRow - updated 10/31/2015 (v2.24.0) */
!function(t){"use strict";var e=t.tablesorter,i=function(e){var i,a,s,o,n,c=e.config;c&&(a=c.widgetOptions,c.$tbodies.each(function(){i=t(this).children(),n=i.length,i.filter(a.staticRow_class).each(function(){i=t(this),void 0!==(o=i.data(a.staticRow_index))?(s=parseFloat(o),o=/%/.test(o)?Math.round(s/100*n):s):o=i.index(),i.data(a.staticRow_data,o)})}))};e.addWidget({id:"staticRow",options:{staticRow_class:".static",staticRow_data:"static-index",staticRow_index:"row-index",staticRow_event:"staticRowsRefresh"},init:function(t,a,s,o){i(t),s.$table.unbind(("updateComplete.tsstaticrows "+o.staticRow_event).replace(/\s+/g," ")).bind("updateComplete.tsstaticrows "+o.staticRow_event,function(){i(t),e.applyWidget(t)})},format:function(e,i,a){var s,o,n,c,d,r,l,p;i.$tbodies.each(function(){for(d=t.tablesorter.processTbody(e,t(this),!0),r=!0,n=0,l=d.children(a.staticRow_class),c=d.children("tr").length-1,p=l.length;r&&n<p;)r=!1,l.each(function(){s=t(this).data(a.staticRow_data),(s=s>=c?c:s<0?0:s)!==t(this).index()&&(r=!0,o=t(this).detach(),s>=c?o.appendTo(d):0===s?o.prependTo(d):o.insertBefore(d.find("tr:eq("+s+")")))}),n++;t.tablesorter.processTbody(e,d,!1)}),i.$table.triggerHandler("staticRowsComplete",e)},remove:function(t,e,i){e.$table.unbind(("updateComplete.tsstaticrows "+i.staticRow_event).replace(/\s+/g," "))}})}(jQuery);