Can I use space as thousands separator?

Can I use space as thousands separator?

jailmijailmi Posts: 1Questions: 1Answers: 0

Hi,

I'm using a comma as decimal separator and a space as thousands separator and trying to get decimals to sort correctly. I'm setting the language.decimal and language.thousands values accordingly but the space as thousands separator doesn't seem to work. If I change it to any other character all is well. The documentation of language.thousands states: "...can be trivially changed to any other character you wish with this parameter". Should I be able to use space as thousands separator or am I missing something?

Here is an example using DataTables live: http://live.datatables.net/wezotux/1/edit. The Salary column is not sorting correctly. If I remove the thousands separating spaces from table data all is well. Also if I use e.g. "thousands": "*" and modify the table data so that * is used in stead of space all is well.

Thanks for a great product and for the new release!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,490Questions: 1Answers: 10,470 Site admin
    Answer ✓

    but the space as thousands separator doesn't seem to work

    The thousands separator in the initialisation is used for output only. Unlike the decimal option it does not effect how data is read into the table. I'll add a note to the documentation to clarify that and have a think about changing that in a future release.

    DataTables doesn't remove a space automatically from a string to detect numbers as it could easily lead to accidentally merging numbers that are not separate. However, DataTables does support the use of thin space (U+2009) and narrow no-break space (U+202F) as thousands separators, which were designed in Unicode to resolve that issue.

    Allan

This discussion has been closed.