currency sorting
currency sorting
I have an application, which I can't share with you since it is password protected unfortunately, that implements a datatable of prices.
I need to be able to sort these prices, which are in the following formatting: [€ 10,00]. At first I didn't give it any thought, but I soon oticed it didn't sort correcty. After some searching, I noticed datatables handled this as a string. So I implemented the currency sorting and currency auto-detect snippets. Which didn't do anything. It added a type to the types array, even though I couldn't see what type in my firebug debugger, but it did add one.
After that I saw the small print on the website that both of these were deprecated in the latest version of the library (1.10.0+). I was on 10.0, so just to make sure, I updated to the latest 1.10.3 and removed my snippets. Now that hasn't amounted to anything and I'm kind of stuck, since I don't really want to code currency sorting myself, seeing there are too many ways differences in formatting between currencies.
Anybody any tips or tricks to get this started?
Answers
Two issues there:
language.decimal
option. DataTables follows the Javascript convention (and every other programming language I'm aware of) of using full stops as the default decimal separator. You would need to use thelanguage.decimal
option to specify your decimal separator (example and manual).I think if you removed the space and used the
language.decimal
option it would work okay. If the space is required you would need to modify one of the available sorting plug-ins to suit your needs.Allan