Sorting Currency

Sorting Currency

jhonovichjhonovich Posts: 3Questions: 0Answers: 0
edited September 2010 in Plug-ins
Allan, DataTables is great. I am very happy with it.

I am trying to get the currency sorting plugin to work. To do so, I copied the dataTableExt.aTypes for currency to automatically detect currency. I then added the oSort for currency ascending and descending. I followed this with initializing my dataTable.

[code] var oTable = $('#camera_results').dataTable( {
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": true,
"bAutoWidth": false } );
new FixedHeader( oTable, { "left": true, "right": false, "bottom": true } );[/code]

I have one column with currency - USD with the format of "$100"

I am obviously doing something wrong. I considered declaring the currency type explicity in the aoColumns but I have many columns and the number of columns may change depending on the user's search request.

Any advice?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi jhonovich,

    My guess is that from some reason the type detection plug-in isn't picking up the type. Which version of DataTables are you using? If 1.6.x of before, then this could be whitespace (1.7.x will trim it automatically). otherwise, then it's likely that you have a character in the column which is not allowed by the plug-in at the moment (allowed chars are "0123456789.-," with £ or $ at the start). Is this possible?

    Regards,
    Allan
This discussion has been closed.