Changeset 411 for branches


Ignore:
Timestamp:
02/18/14 12:13:43 (6 years ago)
Author:
jls17
Message:
  • sorting the tables just affect tbody-rows
  • removed additional loop over sorted rows, because bottom-rows should be placed in tfoot tag
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/work_304/res/sortscript.js

    r410 r411  
    7373    if (table.rows.length <= 1) return; 
    7474    var itm = ts_getInnerText(table.rows[1].cells[column]); 
    75     sortfn = ts_selectSortFunc(itm); 
     75    var sortfn = ts_selectSortFunc(itm); 
    7676 
    7777    SORT_COLUMN_INDEX = column; 
    7878    var newRows = new Array(); 
    79     for (j=1;j<table.rows.length;j++) { newRows[j-1] = table.rows[j]; } 
     79        var tRows; 
     80        var skipFirst = 0; 
     81        if (table.tBodies.length>0) { tRows = table.tBodies[0].rows; } else { tRows = table.rows; skipFirst = 1; } 
     82    for (j=skipFirst;j<tRows.length;j++) { newRows[j-skipFirst] = tRows[j]; } 
    8083 
    8184    newRows.sort(sortfn); 
     
    9194     
    9295    // We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones 
    93     // don't do sortbottom rows 
    94     for (i=0;i<newRows.length;i++) { if (!newRows[i].className || (newRows[i].className && (newRows[i].className.indexOf('sortbottom') == -1))) table.tBodies[0].appendChild(newRows[i]);} 
    95     // do sortbottom rows only 
    96     for (i=0;i<newRows.length;i++) { if (newRows[i].className && (newRows[i].className.indexOf('sortbottom') != -1)) table.tBodies[0].appendChild(newRows[i]);} 
     96    for (i=0;i<newRows.length;i++) { table.tBodies[0].appendChild(newRows[i]); } 
    9797     
    9898    // Delete any other arrows there may be showing 
Note: See TracChangeset for help on using the changeset viewer.