Hi,

Your tablesorter jquery plugin make my life more easy. In our site we use
a lot of tables and Your plugin help us vey much.

But, we have tables with to much "th" with "colspan" in "thead",
and your plugin don't work with these.

I make small modification to your jquery.tablesorte plugin to correct that,
and I hope that help others peoples.

I modify the "buildColumnHeaders" function in the begining as follow:

<code>
         ..............
         ..............
         ..............
                function buildColumnHeaders() {
                         /* Sorry for my english, i hope You understand */
                        /************************************************
                   Here begin Sesilu modification for colspan
                  *************************************************/
                        var oDataSampleRow = oTable.tBodies[0].rows[0];

                        var rowIdx = []; //Remember the first column to 
analyze next time in each row of thead
                        for(var ri = 0; ri < oTable.tHead.rows.length; ri++) 
//Initialize rowIdx in 0 for each row in thead
                          rowIdx[ri]=0;
                       /**
                  Recursively function to check down each cell with colspan 
in thead
                  until cells without colspan.
                  This function have two params:
                    row : index of row of thead to analize.
                    until : How much cells to see in that row.
                  **/
                       function chkCellColSpan(row, until) {
                          var ret = [];
                          var cells = oTable.tHead.rows[row].cells;
                          until += rowIdx[row];
                          for(var i=rowIdx[row]; i < until; i++) {
                             if ( cells[i].colSpan >  1 )
                               ret = 
ret.concat(chkCellColSpan(row+cells[i].rowSpan, cells[i].colSpan));
                             else
                               ret.push(cells[i]);
                             rowIdx[row] = i+1;
                          }
                          return(ret);
                        }

                        var oFirstTableRow = {};
                        oFirstTableRow.cells = chkCellColSpan(0, 
oTable.tHead.rows[0].cells.length);
                  /************************************************
                   Here end Sesilu modification for colspan
                  *************************************************/

                        /** store column length */
                        COLUMN_HEADER_LENGTH = oFirstTableRow.cells.length;

                        /** loop column headers */
                        for( var i=0; i < COLUMN_HEADER_LENGTH; i++ ) {
         ..............
         ..............
         ..............
</code>

Sorry for my english and my "Javascript". I'am not very good with them.

Thank for your work,

Sesilu Nitram.

_________________________________________________________________
MSN Amor: busca tu ½ naranja http://latam.msn.com/amor/


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to