Changeset 410 for branches


Ignore:
Timestamp:
02/18/14 12:13:28 (6 years ago)
Author:
jls17
Message:
  • little clean up in sortscript.js
File:
1 edited

Legend:

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

    r1 r410  
    5151} 
    5252 
     53function ts_selectSortFunc(cellContent) {     
     54    if (cellContent.match(/^\d\d[\/-]\d\d[\/-]\d\d\d\d$/)) return ts_sort_date; 
     55    if (cellContent.match(/^\d\d[\/-]\d\d[\/-]\d\d$/)) return ts_sort_date; 
     56    if (cellContent.match(/^[£$]/)) return ts_sort_currency; 
     57    if (cellContent.match(/^[\d\.]+$/)) return ts_sort_numeric; 
     58        return ts_sort_caseinsensitive; 
     59} 
     60 
    5361function ts_resortTable(lnk) { 
    5462    // get the span 
     
    6573    if (table.rows.length <= 1) return; 
    6674    var itm = ts_getInnerText(table.rows[1].cells[column]); 
    67     sortfn = ts_sort_caseinsensitive; 
    68     if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d\d\d$/)) sortfn = ts_sort_date; 
    69     if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d$/)) sortfn = ts_sort_date; 
    70     if (itm.match(/^[£$]/)) sortfn = ts_sort_currency; 
    71     if (itm.match(/^[\d\.]+$/)) sortfn = ts_sort_numeric; 
     75    sortfn = ts_selectSortFunc(itm); 
     76 
    7277    SORT_COLUMN_INDEX = column; 
    73     var firstRow = new Array(); 
    7478    var newRows = new Array(); 
    75     for (i=0;i<table.rows[0].length;i++) { firstRow[i] = table.rows[0][i]; } 
    7679    for (j=1;j<table.rows.length;j++) { newRows[j-1] = table.rows[j]; } 
    7780 
Note: See TracChangeset for help on using the changeset viewer.