reactive-table icon indicating copy to clipboard operation
reactive-table copied to clipboard

Sorting Based on Date

Open logtomadhu opened this issue 9 years ago • 2 comments

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 avatar Feb 26 '16 19:02 logtomadhu

@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.

allpratik avatar Feb 26 '16 19:02 allpratik

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>");
}

aslagle avatar Feb 27 '16 21:02 aslagle