Totalling number columns including commas (e.g. 1,234.56)
Totalling number columns including commas (e.g. 1,234.56)
stevergill
Posts: 4Questions: 0Answers: 0
Hi
I'm having trouble working this one out. Its miles easier for me to format the source data for datatables with commas i.e. 1,234.56 instead of 1234.56.
However when I try and total I get NaN (not a number). Is there a way I can get the totals to work whilst still keeping the comma formatting?
Test Case here, showing the Retail column not totalling and the percentage column as well: http://live.datatables.net/igamim/2/edit#javascript,html,live
Many thanks!
I'm having trouble working this one out. Its miles easier for me to format the source data for datatables with commas i.e. 1,234.56 instead of 1234.56.
However when I try and total I get NaN (not a number). Is there a way I can get the totals to work whilst still keeping the comma formatting?
Test Case here, showing the Retail column not totalling and the percentage column as well: http://live.datatables.net/igamim/2/edit#javascript,html,live
Many thanks!
This discussion has been closed.
Replies
Allan
Probably you are looking for something like explained here:
http://www.resolved-technologies.com/javascript/jquery-datatables-2/
http://www.resolved-technologies.com/wp-content/themes/PersonalPress/js/dataTablesExample.js
I too was looking for the same solution some time ago and found above link useful.
Cheers.
Thanks!
DataTables 1.10 will provide a similar API method built in.
Allan
Many thanks
If you want to actually add number formatted you'd do so using an mRender function.
Allan