Anyone know of a neat trick to get a ui-table to do sorting by date, rather than standard numeric sort?
Thanks
Anyone know of a neat trick to get a ui-table to do sorting by date, rather than standard numeric sort?
Thanks
Hmm not tested but should be possible:
As you can configure ui-table using ui_config there is certainly a way.
Is your data a string or a unix timestamp?
Some reading for weekend, thank you.
String
A quick jump start .... This should handle your Sting - depending moment.js defined input / output format
{
"tabulator": {
"columns": [
{
"title": "Time",
"field": "timestamp",
"width": 100,
"formatter": "datetime",
"formatterParams": {
"inputFormat": "YYYY-MM-DD HH:mm:ss.SSS",
"outputFormat": "HH:mm:ss",
"invalidPlaceholder": "(invalid time)"
}
}
]
}
}
Thank you. Appreciate it.
So just to close this out. What worked for me (bearing in mind this was date only, no time) was -
{
"tabulator": {
"columns": [
{
"sorterParams": {
"format": "DD/MM/YY"
},
"title": "Date",
"field": "input_date",
"width": 100,
"sorter": "date"
}
}
]
}
}
@Christian-Me thanks for showing me the way!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.