Render Human Readable numbers
Render Human Readable numbers
tux57
Posts: 20Questions: 5Answers: 0
Hello
Is it possible to have a number rendering for a human number format with the render function of datatable ?
example of human number format
100 000 ---------> 100k
10 000 000 -----> 10MM
... ect
Thank you very much
Franck.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
This came up recently in another thread. There isn't an out of the box solution currently, but it is quite possible.
Allan
Hi @tux57 ,
This thread here will help - it was asked recently, and the conclusion was to use numeral.js - see @kthorngren 's second comment.
Cheers,
Colin
it's perfect !
Thank you very much
Best regards,
Franck
I come back to you the solution does not correspond to my request.
https://datatables.net/forums/discussion/comment/134713/#Comment_134713
http://live.datatables.net/gepudopi/1/edit
This solution does not use human readable rendering directly in the array but in the footer. (the sorting does not work in this example)
How can I merge the array rendering engine with the numeral.js function ?
Thank you in advance
Best regards,
Franck
Hi Franck,
You would insert the numeral conversion (something like
numeral(pageTotal).format('0.0a');
) into thecolumns.render
function,Cheers,
Colin
Thank you for your patience but I still can not...
Can you help me directly in my next JS file?
http://live.datatables.net/vananuwo/1/edit
I would like to apply the format on the "price" column with the '0 a' numeral format.
Best regards,
Franck
Yes, we'd be happy to create a working example for you. This is something that would be covered under the support options.
Allan
It's an amateur project, sorry i do not have the money for that.