vue-virtual-table
vue-virtual-table copied to clipboard
Date Formatting
Dates seem to be handled just as strings in this component. Is there any way to at a minimum have the dates formatted.
I have my dates coming back from the server in ISO 8601 format e.g. "2019-08-31T14:36:28.511Z" but I would like to format them in a cleaner way say "August 31st 2019". Is there a way to run an external function on each cell?
You can customize the cell content. Refer to this example
Sorry, I don't see where in that example it shows custom cell content.
You can use like this:
<template slot-scope="scope" slot="actionDate">
<span>{{parseDateFun(scope.row.date)}}</span>
</template>
And add this to the config:
{ prop: "_action", name: "date", actionName: "actionDate" }
That's great thanks ! but I've noticed that sorting in this mode no longer works on the column. Also adding filtering to the column then shows what looks like Chinese buttons with a filter popup that doesn't work.
When using customized cell it's content may be anything even a picture. Thus it's not possible to use these props like "filterable".