I've seen some similar questions, but no correct answer in my case.
I use the DataTables plugin to sort some tables.
But we can't sort datas like numerics while they are not (nut ;-p). For example, we can't sort formatted prices like those :
- 2 150 000 €
- 4 500 000 €
- 225 000 €
So I tried to include a DataTables plugin called "Natural sort". But it doesn't seems to work, I may do some mistakes, but I can't find them.
Any help will be appreciated.
All you need to see/test it : JSfiddle (try to sort the columns...)
Thanks @Ryan P my sType declarations were wrong...
Finaly, I needed to add more plugins to make it work, I share it if it can help someone :
Working example here : http://jsfiddle.net/DzaQe/3/
So it looks like you have two problems. First, dT isn't picking up your custom sort - it's just ignoring it and using the standard sort. I was able to fix this by specifying the sort for each column:
Second, natural sort won't sort those numbers the way you expect. It will take the first number section up until the space and sort on that, like so:
So you probably just want to write your own sort. Here's an example I tried:
The key is removing the spaces, periods and euro signs so that it can be read as a number.