Commit 9775e7e9 authored by Timothy Stack's avatar Timothy Stack

Remove styling and add another sorting function for strings that have

an alpha prefix and a numeric suffix which sorts by the number.
parent 9939529b
...@@ -89,6 +89,7 @@ function ts_resortTable(lnk) { ...@@ -89,6 +89,7 @@ function ts_resortTable(lnk) {
if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d\d\d$/)) sortfn = ts_sort_date; if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d\d\d$/)) sortfn = ts_sort_date;
if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d$/)) sortfn = ts_sort_date; if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d$/)) sortfn = ts_sort_date;
if (itm.match(/^[$]/)) sortfn = ts_sort_currency; if (itm.match(/^[$]/)) sortfn = ts_sort_currency;
if (itm.match(/^[a-zA-Z]*[\d\.]+$/)) sortfn = ts_sort_prefixed_numeric;
if (itm.match(/^[\d\.]+$/)) sortfn = ts_sort_numeric; if (itm.match(/^[\d\.]+$/)) sortfn = ts_sort_numeric;
SORT_COLUMN_INDEX = column; SORT_COLUMN_INDEX = column;
var firstRow = new Array(); var firstRow = new Array();
...@@ -171,8 +172,18 @@ function ts_sort_currency(a,b) { ...@@ -171,8 +172,18 @@ function ts_sort_currency(a,b) {
function ts_sort_numeric(a,b) { function ts_sort_numeric(a,b) {
aa = parseFloat(ts_getInnerText(a.cells[SORT_COLUMN_INDEX])); aa = parseFloat(ts_getInnerText(a.cells[SORT_COLUMN_INDEX]));
if (isNaN(aa)) aa = 0; if (isNaN(aa)) aa = Number.MIN_VALUE;
bb = parseFloat(ts_getInnerText(b.cells[SORT_COLUMN_INDEX])); bb = parseFloat(ts_getInnerText(b.cells[SORT_COLUMN_INDEX]));
if (isNaN(bb)) bb = Number.MIN_VALUE;
return aa-bb;
}
function ts_sort_prefixed_numeric(a,b) {
aa = parseFloat(ts_getInnerText(a.cells[SORT_COLUMN_INDEX]).
replace(/^[a-zA-Z]*/, ""));
if (isNaN(aa)) aa = 0;
bb = parseFloat(ts_getInnerText(b.cells[SORT_COLUMN_INDEX]).
replace(/^[a-zA-Z]*/, ""));
if (isNaN(bb)) bb = 0; if (isNaN(bb)) bb = 0;
return aa-bb; return aa-bb;
} }
......
...@@ -180,15 +180,3 @@ span.topbaroption { background-color:#E1E1EA; } ...@@ -180,15 +180,3 @@ span.topbaroption { background-color:#E1E1EA; }
.textInputEmpty { .textInputEmpty {
color: #888888 color: #888888
} }
/* Sortable tables */
table.sortable a.sortheader {
color:#666666;
font-weight: bold;
text-decoration: none;
display: block
}
table.sortable span.sortarrow {
color: black;
text-decoration: none
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment