How can I sort the "days ago" formatted date in jqGrid ? When I sort the grid currently, it can't distinguish between "11 hours ago" and "1 days ago". So "1 day ago" is sorted on the top instead of "11 hours ago".
**Please refer this image of the grid.
My jqGrid has the following code. recommendationData is JSON. Posted column is the date.
$("#tblRecommendationList").jqGrid({
data: recommendationData,
datatype: 'local',
colModel: [
{ name: 'Title', label: 'Title', width: 210, resizable: true },
{ name: 'Channel', label: 'Content Type', width: 120, resizable: true },
{ name: 'StatusNumber', label: 'Status', width: 120, resizable: true,
formatter: GetStatusCode },
{ name: 'Posted', label: 'Posted', width: 120, resizable: true },
{ name: 'RecordId', label: 'RecordId', hidden: true }
],
loadtext: 'Loading...',
loadui: 'block',
emptyDataText: "No Recommendations to display",
shrinkToFit: true,
The date is passed in the following manner.
...
returnList =
(
from i in responseList
select new InQuiraRecommendation
{
StatusNumber = i.statusnumber,
Title = i.title,
Text = i.text,
Posted = GetDaysAgo(i.dateadded),
CaseNumber = i.casenumber,
Priority = i.priority,
Channel = i.channel,
RecordId = i.recordid,
}
).ToList();
}
return returnList;
}
GetDaysAgo( ) changes the "2012-09-13 07:00:00 Etc/GMT" date format to "Days ago" format.