Skip to content

Instantly share code, notes, and snippets.

@melihucar
Created October 28, 2014 13:09
Show Gist options
  • Select an option

  • Save melihucar/0d54a3076a74f2c7fd65 to your computer and use it in GitHub Desktop.

Select an option

Save melihucar/0d54a3076a74f2c7fd65 to your computer and use it in GitHub Desktop.
Datatable currency sort
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"currency-pre": function ( a ) {
a = (a==="-") ? 0 : a.replace( /[^\d\-\.]/g, "" );
return parseFloat( a );
},
"currency-asc": function ( a, b ) {
return a - b;
},
"currency-desc": function ( a, b ) {
return b - a;
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment