Using momentJS in datatables.
Using momentJS in datatables.
utkant
Posts: 8Questions: 4Answers: 0
Hi!
How would I use momentJS in datatables?
Say I have a column with a momentJS object and I want to update that column so that it showed me the correct information in the browser. How would I do that?
And as a followup. How would I update this if I wanted to change the format of the output from the momentJs object?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I managed to get this working by using the render function in the aColumnDefs setting. This now works beautifully. But I have one issue. If I want that function to be rerun on or before a draw on the table so that I can switch the format of the output how would that be done?
How would I go about to get the render function rerun during a call to the draw() function
You would need to invalidate the row (
row().invalidate()
) to have the data refreshed.Allan
Thanks Allan.
If you want all rows you can use rows().invalidate(). Just a tips for everyone else who needs this.