|
jsm | |||||||
PREV NEXT | FRAMES NO FRAMES |
No overview generated for 'net/sf/jsm/table/comparators/jsmDateComparator.js'
Class Summary | |
JsmDateComparator | Comparator comparing {@see JsmTr} objects where the sort column is composed of date values |
/** * Comparator comparing {@see JsmTr} objects where the sort column is composed of date values * Uses the date script (which has to be loaded in your page) of Matt Kruse: http://www.JavascriptToolbox.com/lib/date/ * This library will recognize some common date patterns. If this does not work use the setFormat function on this comparator * before first using the {@see JsmTable#sort} function. * If you need to specify multiple date formats in a single html page you will need to use the {@see JsmTh#setOnClick} function * to specify the format of the comparator before the {@see JsmTable#sort} function is called. * @class Comparator comparing {@see JsmTr} objects where the sort column is composed of date values * @constructor * @param {JsmTr} o1 The first row * @param {JsmTr} o2 The second row */ function JsmDateComparator(o1,o2) { var value1 = o1.getSortColumnValue(); var value2 = o2.getSortColumnValue(); value1 = Date.parseString(value1, JsmDateComparator.format); value2 = Date.parseString(value2, JsmDateComparator.format); if(value1<value2) { return -1; } if(value1>value2) { return 1; } return 0; } /** * The format to parse the date-string */ JsmDateComparator.format=null; /** * Set the format to parse the date-string */ JsmDateComparator.setFormat = function(format) {JsmDateComparator.format=format;}
|
jsm | |||||||
PREV NEXT | FRAMES NO FRAMES |