Ir a la navegación
Ir a la búsqueda
Busca en cnbGuatemala con Google
622 bytes añadidos
, hace 7 años
Línea 1: |
Línea 1: |
| + | /*table grouping*/ |
| + | |
| + | $(function() { |
| + | function groupTable($rows, startIndex, total){ |
| + | if (total === 0){ |
| + | return; |
| + | } |
| + | var i , currentIndex = startIndex, count=1, lst=[]; |
| + | var tds = $rows.find('td:eq('+ currentIndex +')'); |
| + | var ctrl = $(tds[0]); |
| + | lst.push($rows[0]); |
| + | for (i=1;i<=tds.length;i++){ |
| + | if (ctrl.text() == $(tds[i]).text()){ |
| + | count++; |
| + | $(tds[i]).addClass('deleted'); |
| + | lst.push($rows[i]); |
| + | } |
| + | else{ |
| + | if (count>1){ |
| + | ctrl.attr('rowspan',count); |
| + | groupTable($(lst),startIndex+1,total-1) |
| + | } |
| + | count=1; |
| + | lst = []; |
| + | ctrl=$(tds[i]); |
| + | lst.push($rows[i]); |
| + | } |
| + | } |
| + | } |
| + | groupTable($('.groupTable tr:has(td)'),0,3); |
| + | $('#myTable .deleted').remove(); |
| + | }); |
| + | |
| + | |
| /*hide empty table columns*/ | | /*hide empty table columns*/ |
| ( function ( $, mw ) { | | ( function ( $, mw ) { |