function docready() { var row = []; var ix=0; $('tr.ms-ganttTaskRow th').each( function() { row[ix] = $(this).parent(); ix++; } ); ix=0; for(ix=1; ix< row.length; ix++){ var $prevrow = row[ix].prev(); var prevtxt = $prevrow.find('th').text(); var curtxt = row[ix].find('th').text(); if (prevtxt == curtxt) { var colix =0; row[ix].find('td').each( function() { var ht = $(this).html(); if (ht.length > 0){ $prevrow.find('td:eq('+colix+')').html(ht); } colix++; } ); row[ix].remove(); } } } _spBodyOnLoadFunctionNames.push("docready");
Explanation of the code:
- Trigger the docready on load
- Store all the rows in an jquery array for easy processing
- Walk through the rows array starting from second item and match the row header with previous row, if so, copy the contents of the columns to the row above and remove after processed.
1 comment:
this doesnt work with Sharepoint 2010
Post a Comment