liuwenchao / aha-table

A Polymer element for a searchable, sort-able, paginate-able, inline-editable, select-able, copy-able, removable data table or grid generated by JSON data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

datetime examples

hereiam133 opened this issue · comments

What is the proper format that needs to be used for the datetime sort to work? There is currently no example. Or can the time in milliseconds be used on it and hidden and have that used as the sort?

found a workaround using html and setting the data to the millisecond timestamp

Hi Jason Bourbeau(hereiam133), could you share what work around you tried for the sort to work with date time. An example will be very helpful.

Sure, I set the type for that column to html, and then put the datetime in a div with a data attribute of datetime as the first thing in the div.

So an example of what you would put in the column would be:

<div data-datetime="actual_time_stamp"> converted_time_to_display </div>

By having the timestamp or time in milliseconds as the data-datetime and then formatting it in the converted_time_to_display you can still show the users the time in a readable format but the data-datetime is used for sorting as its the 1st unique thing in the element for it to sort on.