Change format of data inside datatable column
Change format of data inside datatable column

Is there a way to add text or change format of the data inside datatable such as add INR in front of amounts of amount column. Or to change the format of the date that we initially get?
This question has accepted answers - jump to:
This discussion has been closed.
Answers
You will want to take a look at the Orthogonal data and Renderers docs for all the options. Also the Data rendering and Column rendering examples may help.
Kevin
To add INR in front of data in a column you can either use the rendering options of datatables or you can simply use a pseudo class :: before in the css class applied to that data.
https://css-tricks.com/almanac/selectors/a/after-and-before/
As someone who recently discovered the rendering options of datatables, it allows you to manipulate the data displayed (through javascript operation) of that cell but also having access to the whole array of data for that TR (you can even just change the display and leave the data searchable in its original form by only applying rendering to the type:display).
The example that really opened up my understanding of this was the columndefs example given in this thread :
https://datatables.net/forums/discussion/33723/new-user-help-columns-vs-columndefs-for-client-side-rendering-of-ajax-data
Thank You,
@kthorngren and @yericus
I looked into it and with a bit of tweaking I got exactly what i wanted.