Changeset 5794
- Timestamp:
- 07/25/08 08:05:17 (1 month ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/tablesorter/2.0/jquery.tablesorter.js
r5780 r5794 22 22 * @desc Create a tablesorter interface and sort on the first and secound column in ascending order. 23 23 * 24 * @example $('table').tablesorter({ headers: { 0: { sorter: false}, 1: {sorter: false} } } );24 * @example $('table').tablesorter({ headers: { 0: { sorter: false}, 1: {sorter: false} } } }); 25 25 * @desc Create a tablesorter interface and disableing the first and secound column headers. 26 26 * … … 443 443 var order = sortList[i][1]; 444 444 //var s = (getCachedSortType(table.config.parsers,c) == "text") ? ((order == 0) ? "sortText" : "sortTextDesc") : ((order == 0) ? "sortNumeric" : "sortNumericDesc"); 445 var s = (table.config.parsers[c].type == "text") ? ((order == 0) ? makeSortText(c) : makeSortTextDesc(c)) : ((order == 0) ? makeSortNumeric(c) : makeSortNumericDesc(c)); 445 //var s = (table.config.parsers[c].type == "text") ? ((order == 0) ? makeSortText(c) : makeSortTextDesc(c)) : ((order == 0) ? makeSortNumeric(c) : makeSortNumericDesc(c)); 446 var s = (table.config.parsers[c].type == "text") ? ((order == 0) ? makeSortFunction("text", "asc", c) : makeSortFunction("text", "desc", c)) : ((order == 0) ? makeSortFunction("numeric", "asc", c) : makeSortFunction("numeric", "desc", c)); 446 447 var e = "e" + i; 447 448 … … 464 465 465 466 if(table.config.debug) { benchmark("Evaling expression:" + dynamicExp, new Date()); } 466 467 467 468 eval(dynamicExp); 468 469 … … 472 473 473 474 return cache; 475 }; 476 477 function makeSortFunction(type, direction, index) { 478 var a = "a[" + index + "]", b = "b[" + index + "]"; 479 if (type == 'text' && direction == 'asc') { 480 return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + a + " < " + b + ") ? -1 : 1 )));"; 481 } else if (type == 'text' && direction == 'desc') { 482 return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + b + " < " + a + ") ? -1 : 1 )));"; 483 } else if (type == 'numeric' && direction == 'asc') { 484 return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + a + " - " + b + "));"; 485 } else if (type == 'numeric' && direction == 'desc') { 486 return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + b + " - " + a + "));"; 487 } 474 488 }; 475 489 … … 756 770 id: "currency", 757 771 is: function(s) { 758 return /^[ £$€?.]/.test(s);772 return /^[£$€?.]/.test(s); 759 773 }, 760 774 format: function(s) {
