reactive-table
reactive-table copied to clipboard
Sorting Based on Date
Hi,
Am very happy to use this package and i stuck in where sorting the table by Date.
My date format is DD-MMM-YYYY (for ex.01-feb-2016) .if it possible to sort based on this! and please provide suggestion to this.
Thanks, Madhu
@logtomadhu Do you store date in above format in db or as an ISO format? You can use custom filters option to sort values. Let me know if you need any help there.
If you're not using the server-side publishing option, you can add an fn option to your field. It controls the sorting and the value that's displayed, so you'd have to make it HTML with a hidden value to sort by.
fn: function (originalDate) {
var sortValue = "..."; // parse date format here and get value to sort by
return new Spacebars.SafeString("<span sort=" + sortValue + ">" + originalDate + "</span>");
}