mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
2 lines
1.3 KiB
JavaScript
2 lines
1.3 KiB
JavaScript
/*! Widget: vertical-group (BETA) - updated 12/13/2017 (v2.29.1) */
|
|
!function(r){"use strict";function e(r){r.removeClass(i.verticalGroupHide+" "+i.verticalGroupShow)}function a(r,e,a){e.parent().removeClass(r.zebra[(a+1)%2]).addClass(r.zebra[a%2])}function o(o,l,s,c){var u=-1,v=o.tBodies[0].rows,d=(o.tHead.rows,t.hasWidget(o,"zebra")),p=[],n=[];if(!s.vertical_group_lock){if(s.vertical_group_lock=!0,""===(p=r.map(l.$headerIndexed,function(r){return r.hasClass(i.verticalGroupHeader)?1:""})).join(""))return e(r(v).find("."+i.verticalGroupHide+",."+i.verticalGroupShow)),void(s.vertical_group_lock=!1);for(var h=0;h<v.length;h++)for(var G=!1,f=0;f<l.columns;f++)if(p[f]&&v[h].cells[f]){var g=r(v[h].cells[f]),C=t.isValueInArray(f,l.sortList),w=g.html();C<0?e(g):G||w!==n[f]?0===C&&(G=!0,g.hasClass(i.verticalGroupShow)||g.addClass(i.verticalGroupShow),g.removeClass(i.verticalGroupHide),d&&a(s,g,C?u:++u)):(g.hasClass(i.verticalGroupHide)||g.addClass(i.verticalGroupHide),d&&a(s,g,u),g.removeClass(i.verticalGroupShow)),n[f]=w}else u++;s.vertical_group_lock=!1}}var t=r.tablesorter,i=t.css;r.extend(t.css,{verticalGroupHeader:"tablesorter-vertical-group",verticalGroupHide:"tablesorter-vertical-group-hide",verticalGroupShow:"tablesorter-vertical-group-show"}),t.addWidget({id:"vertical-group",priority:99,init:o,format:o})}(jQuery); |