I've got a pretty standard USD currency column but sorting doesn't seem to detect that it's a currency. For my particular set of data, when I sort, I get the following:
If you've included the two plug-ins as shown in the example, then it should all just automatically work. The column type will be detected as 'currency' and the column will sort as required. Make sure that the plug-ins are added after the DataTables JS file, but before initialising the table.
Well, I've added that chunk of code to a .js that's loaded after jquery and data tables, and it doesn't look like it's being called at all (i threw a couple alerts in there)
Is there anything I can do to debug this to see which functions it's calling to sort this? Perhaps it's detecting it wrong?
If you run "console.dir( oTable.fnSettings().aoColums );" in Firebug and look for the array element which contains the information for your currency column, that will tell you the type - and if it's been detected correctly or not. Failing that, then there might be a bug in the sorting functions themselves. Do you have a link you could provide - it might made debugging easier. If you have one but don't want to make it public, you can send it to me direct at http://datatables.net/contact .
Ok, looks like it's being detected as a string, where the column right next to it is correctly being detected as a date.
Unfortunately this particular project is an internal company, so I am unable to let you take a look. I realize this makes it much more difficuilt for you :(
Is there any way to debug the sort-detect function?
Assuming you have the currency type detection plug-in installed correctly, it should add currency type detection to the aTypes array. The formatting for the currency detection is fairly strict, you can't have any white space in the table cell (you can modify the plug-ins to add support for this if you need), and only there characters -0123456789 and . or , are allowed, with a $ or £ at the start. Does that match your current formatting?
Welp, turns out I had the sort functions in there, but not the auto detection. Maybe they should be all together instead of split up? Or maybe I'm just dumb.
Regardless, it works now so I'm going to go sit in the corner and be ashamed of myself for not figuring it out on my own.
They could probably do with a link from one to the other on the plug-in pages other than just being mentioned in the text. I'll add it to the to-do list :-)