JQuery datatable fnRender does not work in IE all versions
Hi,I'm using jQuery datatable plugin to sort my Datetime column of my table.
I get datetime from database as "07/23/2015 3:45:33 AM", but I have to display as 23-Jul-15 3:45:33 AM".
If I format the date column to the required format and try to sort, then it sorts as string, not as datetime. I tried giving "sType: date" also, but no luck.
Finally decided to use fnRender() in "aoColumns". This works fine in Chrome, but not in IE all versions. Unable to figure out the reason.
Code is like below:
"aoColumns": [
{
"sWidth": "150px",
"fnRender": function (oObj) {
var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
var inputDate = oObj.aData[0];
var splitsDate = inputDate.split(' ')[0];
var splits = splitsDate.split('/');
var splitsTime = inputDate.split(' ')[1] + ' ' + inputDate.split(' ')[2];
var fDate = ($.trim(splits[1]).length == 1 ? '0' + splits[1] : splits[1]) + '-' + months[$.trim(splits[0] - 1)] + '-' + $.trim(splits[2]).substring(2) + ' ' + splitsTime;
return fDate;
}
}]