}
util.date.db_date2Date = function (db_date) {
- if (!db_date) { return db_date; }
- if (typeof window.dojo != 'undefined') {
+ if (!db_date) { /* we get stringified null at times */
+ return new Date(-8640000000000000); /* minimum possible date.
+ max is this * -1. */
+ } else if (typeof window.dojo != 'undefined') {
dojo.require('dojo.date.stamp');
return dojo.date.stamp.fromISOString( db_date.replace( /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[\+-]\d{2})(\d{2})$/, '$1:$2') );
} else {
var my = row.my;
var values = [];
+ var sort_values = [];
var cmd = '';
try {
for (var i = 0; i < cols.length; i++) {
case 'string' : cmd += 'try { ' + cols[i].render + '; values['+i+'] = v; } catch(E) { values['+i+'] = error_value; }'; break;
default: cmd += 'values['+i+'] = "??? '+(typeof cols[i].render)+'"; ';
}
+ switch (typeof cols[i].sort_value) {
+ case 'function':
+ try {
+ sort_values[i] = cols[i].sort_value(my,scratch);
+ } catch(E) {
+ sort_values[i] = error_value;
+ obj.error.sdump('D_COLUMN_RENDER_ERROR',E);
+ }
+ break;
+ case 'string' :
+ sort_values[i] = JSON2js(cols[i].sort_value);
+ break;
+ default:
+ cmd += 'sort_values['+i+'] = values[' + i + '];';
+ }
}
if (cmd) eval( cmd );
} catch(E) {
obj.error.sdump('D_WARN','map_row_to_column: ' + E);
if (error_value) { value = error_value; } else { value = ' ' };
}
- return values;
+ return {values: values, sort_values: sort_values};
}
}