how to render and sort mm-dd-yyyy
how to render and sort mm-dd-yyyy
I have implemented datatables and have been trying for several hours to get the data to display and sort properly to no avail. I wish to display the data as mm-dd-yy. I could use mm/dd/yy, but I have pre 2000 dates, so the 99's sort highest instead of lowest. I changed the data to send a 4 digit year, but do not want to display it. I tried this:
$('#shiporderinfotable').dataTable( {
"data": dataSet,
"columns": [
{ "title": "Store", "class": "dr" },
{ "title": "Order#", "class": "dr" },
{ "title": "Cust PO#", "class": "dl" },
{ "title": "Order Date", "class": "dr" },
{ "title": "Invoice", "class": "dr" },
{ "title": "Inv Date", "class": "dr" },
{ "title": "Qty<br>Ord", "class": "dr" },
{ "title": "Qty<br>Shp", "class": "dr" },
{ "title": "Qty<br>Open", "class": "dr" },
{ "title": "Qty<br>Pick", "class": "dr" },
{ "title": "Pick<br>Date", "class": "dr" },
{ "title": "Items", "class": "dl" }
],
"columnDefs": [
{
"render": function ( data, type, row ) {
return data.substr(0,2)+'-'+data.substr(3,2)+'-'+data.substr(8,2);
},
"targets": [3,5,10]
}]
} );
if I take out the render statement, it sorts fine. Once I add the render statement, it is doing a left justified character sort. Is there a way to do the render only for display and not sorting?