mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-12-05 05:04:20 +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(t.verticalGroupHide+" "+t.verticalGroupShow)}function a(r,e,a){e.parent().removeClass(r.zebra[(a+1)%2]).addClass(r.zebra[a%2])}function o(o,l,s){var c=-1,u=o.tBodies[0].rows,v=i.hasWidget(o,"zebra"),d=[],p=[];if(!s.vertical_group_lock){if(s.vertical_group_lock=!0,""===(d=r.map(l.$headerIndexed,function(r){return r.hasClass(t.verticalGroupHeader)?1:""})).join(""))return e(r(u).find("."+t.verticalGroupHide+",."+t.verticalGroupShow)),void(s.vertical_group_lock=!1);for(var n=0;n<u.length;n++)for(var h=!1,G=0;G<l.columns;G++)if(d[G]&&u[n].cells[G]){var f=r(u[n].cells[G]),g=i.isValueInArray(G,l.sortList),C=f.html();g<0?e(f):h||C!==p[G]?0===g&&(h=!0,f.hasClass(t.verticalGroupShow)||f.addClass(t.verticalGroupShow),f.removeClass(t.verticalGroupHide),v&&a(s,f,g?c:++c)):(f.hasClass(t.verticalGroupHide)||f.addClass(t.verticalGroupHide),v&&a(s,f,c),f.removeClass(t.verticalGroupShow)),p[G]=C}else c++;s.vertical_group_lock=!1}}var i=r.tablesorter,t=i.css;r.extend(i.css,{verticalGroupHeader:"tablesorter-vertical-group",verticalGroupHide:"tablesorter-vertical-group-hide",verticalGroupShow:"tablesorter-vertical-group-show"}),i.addWidget({id:"vertical-group",priority:99,init:o,format:o})}(jQuery); |