Thousand separator with space
Thousand separator with space
jbouv55151
Posts: 4Questions: 2Answers: 0
Hi,
I would like to use a space as thousand separator (french) but it doesn't work:
Format number: 123 456,78
So, I use language:
"language": {
"decimal": ",",
"thousands": " "
}
Test case
It doesn't work.
Any idea to solve that ?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
This thread has some valuable information on it:
https://datatables.net/forums/discussion/comment/169060/#Comment_169060
Pretty similar: thousand separator should be a period and decimal point should be a comma like in most of continental Europe. 123.456,78
There had been a bug in this as well which probably will have been fixed by now:
https://datatables.net/forums/discussion/59328
Thank you for your feedback.
I am not sure to completely understand your answer.
I don't have any problem to show numbers correctly but to sort it. I have not problem to do it if thousand separator is coma, point or '. But sorting doesn't work with space.
Any idea ?
You did not mention sorting or ordering!
https://stackoverflow.com/questions/53238318/html5-javascript-datatables-order-sort-of-columns/53238593#53238593
DataTables does not detect numbers with a space in them as a number (even with the
language.thousands
option set). This is the relevant code.However, it does automatically support thin space (\u2009) and narrow no-break space (\u202F).
Here is your example updated to use a thin space: http://live.datatables.net/zonelaho/2/edit .
Are you able to update your output to use that? If not, then a renderer could be used to remove the space when getting the type and sorting data.
Allan
Thank you allan,
I use thin space ( ) as thousand separator and it works great !